fix: skip non-existent collection
This commit is contained in:
parent
df2137da79
commit
5000affc26
@ -54,6 +54,9 @@ export class AutomationJobModel extends Model {
|
|||||||
const jobType = this.get('type');
|
const jobType = this.get('type');
|
||||||
const collectionName = this.get('collection_name');
|
const collectionName = this.get('collection_name');
|
||||||
const M = this.database.getModel(collectionName);
|
const M = this.database.getModel(collectionName);
|
||||||
|
if (!collectionName || !M) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let filter: any = this.toFilter(result);
|
let filter: any = this.toFilter(result);
|
||||||
let data: any = this.toValues(result);
|
let data: any = this.toValues(result);
|
||||||
const { where = {} } = M.parseApiJson({ filter });
|
const { where = {} } = M.parseApiJson({ filter });
|
||||||
|
@ -82,6 +82,9 @@ export class AutomationModel extends Model {
|
|||||||
const changedFields = (this.get('changed') as any) || [];
|
const changedFields = (this.get('changed') as any) || [];
|
||||||
const M = this.database.getModel(collectionName);
|
const M = this.database.getModel(collectionName);
|
||||||
const automationType = this.get('type');
|
const automationType = this.get('type');
|
||||||
|
if (automationType !== 'schedule' || !collectionName || !M) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (automationType) {
|
switch (automationType) {
|
||||||
case 'collections:afterCreate':
|
case 'collections:afterCreate':
|
||||||
M.addHook('afterCreate', hookName, async (model, options) => {
|
M.addHook('afterCreate', hookName, async (model, options) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user