feat: Create flow model and graphQL mutation
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
b42cb759a5
commit
8a7d54bb25
31
packages/backend/src/models/flow.ts
Normal file
31
packages/backend/src/models/flow.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import Base from './base'
|
||||
import Step from './step'
|
||||
|
||||
class Flow extends Base {
|
||||
id!: number
|
||||
userId!: number
|
||||
|
||||
static tableName = 'flows';
|
||||
|
||||
static jsonSchema = {
|
||||
type: 'object',
|
||||
|
||||
properties: {
|
||||
id: { type: 'integer' },
|
||||
userId: { type: 'integer' }
|
||||
}
|
||||
}
|
||||
|
||||
static relationMappings = () => ({
|
||||
steps: {
|
||||
relation: Base.HasManyRelation,
|
||||
modelClass: Step,
|
||||
join: {
|
||||
from: 'flows.id',
|
||||
to: 'steps.flow_id',
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default Flow;
|
Reference in New Issue
Block a user