All files / src/models company-regulatory.model.ts

95.83% Statements 23/24
100% Branches 0/0
80% Functions 4/5
95.45% Lines 21/22

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 81 82 83 84 851x 1x 1x 1x   1x             1x   40x 1x           1x           1x         1x         1x         1x           1x     40x 1x             1x     40x 1x   40x 1x                                    
import { model, property, belongsTo, hasMany } from '@loopback/repository';
import { User, CompanyRegulatoryHistories } from '@logchain/models';
import { BaseEntity, Company } from '.';
import { Exclude } from 'class-transformer';
 
export const sharedProperties = ['uen', 'tradeweb_id', 'duration_start', 'duration_end', 'status', 'created_date'];
 
@model({
  settings: {
    postgresql: { table: 'company_regulatory' },
  },
})
export class CompanyRegulatory extends BaseEntity {
  @Exclude()
  @belongsTo(() => Company, { name: 'company' })
  company_id: number;
 
  @property({
    type: 'string',
    required: true,
  })
  uen: string;
 
  @property({
    type: 'string',
    required: true,
  })
  tradeweb_id: string;
 
  @property({
    type: 'date',
  })
  duration_start: Date;
 
  @property({
    type: 'date',
  })
  duration_end: Date;
 
  @property({
    type: 'number',
  })
  status: number;
 
  @property({
    type: 'date',
    defaultFn: 'now',
  })
  created_date: Date;
 
  @Exclude()
  @belongsTo(() => User, { name: 'creator' })
  created_by?: number;
 
  @Exclude()
  @property({
    type: 'date',
    defaultFn: 'now',
  })
  modified_date: Date;
 
  @Exclude()
  @belongsTo(() => User, { name: 'modifier' })
  modified_by?: number;
 
  @hasMany(() => CompanyRegulatoryHistories, { keyTo: 'company_regulatory_id', keyFrom: 'id', name: "histories"})
  histories: CompanyRegulatoryHistories[];
 
  constructor(data?: Partial<CompanyRegulatory>) {
    super(data);
  }
}
 
export interface CompanyRegulatoryRelations {
  company?: Company;
  creator?: User;
  modifier?: User;
 
  // Allow Regulatory Filing or not
  is_allowed: boolean;
  regulatory_status?: boolean;
}
 
export type CompanyRegulatoryWithRelations = CompanyRegulatory & CompanyRegulatoryRelations;