All files / src/models request-discussion.model.ts

95% Statements 19/20
100% Branches 0/0
80% Functions 4/5
94.44% Lines 17/18

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 721x 1x 1x 1x                                 1x         1x   72x 1x           1x             1x             1x   72x 1x   72x 1x   72x 1x                            
import {belongsTo, model, property} from '@loopback/repository';
import {User, UserWithRelations} from '.';
import {BaseEntity} from './base-entity';
import {Request} from './request.model';
 
@model({
  settings: {
    postgresql: {table: 'request_discussions'},
    foreignKeys: {
      fk_request_discussions_requests_id: {
        name: 'fk_request_discussions_requests_id',
        entity: 'Request',
        entityKey: 'id',
        foreignKey: 'request_id',
        onDelete: 'CASCADE',
        onUpdate: 'RESTRICT'
      },
    },
  },
})
export class RequestDiscussion extends BaseEntity {
  @property({
    type: 'number',
    required: true,
  })
  user_type: number;
 
  @belongsTo(() => User, {name: 'request_discussion_user'})
  user_id: number;
 
  @property({
    type: 'string',
    required: true,
  })
  comment: string;
 
  @property({
    type: 'date',
    required: true,
    defaultFn: 'now',
  })
  created_date: Date;
 
  @property({
    type: 'date',
    required: false,
    defaultFn: 'now',
  })
  modified_date: Date;
 
  @belongsTo(() => User, {name: 'modifier'})
  modified_by: number;
 
  @belongsTo(() => User, {name: 'creator'})
  created_by: number;
 
  @belongsTo(() => Request, {name: 'request_discussion'})
  request_id: number;
 
  constructor(data?: Partial<RequestDiscussion>) {
    super(data);
  }
}
 
export interface RequestDiscussionRelations {
  // describe navigational properties here
  request_discussion_user?: UserWithRelations;
}
 
export type RequestDiscussionWithRelations = RequestDiscussion &
  RequestDiscussionRelations;