Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 1x 1x 1x 1x 1x 96x 1x 1x 1x 1x 96x 1x 96x 1x 1x | import {belongsTo, model, property} from '@loopback/repository';
import {Exclude, Expose} from 'class-transformer';
import {Company, Flow, Status, User} from '.';
import {Created} from '../types';
import {BaseEntity} from './base-entity';
@model({
settings: {
postgresql: {table: 'flows_discussion'},
scope: {
order: ['created_date DESC'],
},
},
})
export class FlowDiscussion extends BaseEntity implements Created {
@belongsTo(() => Flow, {name: 'flow'})
flow_id: number;
@Exclude()
@property({
type: 'number',
required: true,
})
status: number;
@property({
type: 'string',
jsonSchema: {
nullable: true,
},
})
@Expose({name: 'remarks'})
comment: string;
@property({
type: 'date',
required: true,
defaultFn: 'now',
})
created_date: Date;
@belongsTo(() => User, {name: 'creator'})
created_by: number;
@belongsTo(() => Company, {name: 'company'})
company_id: number;
@Expose()
status_name() {
switch (this.status) {
case Status.Flow.New:
return 'New';
case Status.Flow.InProgress:
return 'In Progress';
case Status.Flow.ForValidation:
return 'For Validation';
case Status.Flow.Validated:
return 'Validated';
case Status.Flow.Rejected:
return 'Rejected';
case Status.Flow.Live:
return 'Active';
}
}
constructor(data?: Partial<FlowDiscussion>) {
super(data);
}
}
export interface FlowDiscussionRelations {
// describe navigational properties here
creator?: User;
modifier?: User;
flow?: Flow;
}
export type FlowDiscussionWithRelations = FlowDiscussion &
FlowDiscussionRelations;
|