refactor: Use related query from objectionjs for mutations

This commit is contained in:
Faruk AYDIN
2022-01-29 12:07:19 +03:00
committed by Ömer Faruk Aydın
parent e7c537f217
commit 86d5cceec7
11 changed files with 170 additions and 136 deletions

View File

@@ -1,10 +1,11 @@
import Base from './base'
import Step from './step'
import Base from './base';
import Step from './step';
class Flow extends Base {
id!: number
userId!: number
active: boolean
id!: number;
userId!: number;
active: boolean;
steps?: [Step];
static tableName = 'flows';
@@ -14,9 +15,9 @@ class Flow extends Base {
properties: {
id: { type: 'integer' },
userId: { type: 'integer' },
active: { type: 'boolean' }
}
}
active: { type: 'boolean' },
},
};
static relationMappings = () => ({
steps: {
@@ -26,8 +27,8 @@ class Flow extends Base {
from: 'flows.id',
to: 'steps.flow_id',
},
}
})
},
});
}
export default Flow;