chore: Introduce has many steps through flows for user model
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
700d0bfd32
commit
3429784309
@@ -2,6 +2,7 @@ import { QueryContext, ModelOptions } from 'objection';
|
||||
import Base from './base';
|
||||
import Connection from './connection';
|
||||
import Flow from './flow';
|
||||
import Step from './step';
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
class User extends Base {
|
||||
@@ -10,6 +11,7 @@ class User extends Base {
|
||||
password!: string;
|
||||
connections?: [Connection];
|
||||
flows?: [Flow];
|
||||
steps?: [Step];
|
||||
|
||||
static tableName = 'users';
|
||||
|
||||
@@ -41,6 +43,18 @@ class User extends Base {
|
||||
to: 'flows.user_id',
|
||||
},
|
||||
},
|
||||
steps: {
|
||||
relation: Base.ManyToManyRelation,
|
||||
modelClass: Step,
|
||||
join: {
|
||||
from: 'users.id',
|
||||
through: {
|
||||
from: 'flows.user_id',
|
||||
to: 'flows.id',
|
||||
},
|
||||
to: 'steps.flow_id',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
login(password: string) {
|
||||
|
Reference in New Issue
Block a user