All files / src/dtos company-regulatory.dto.ts

60% Statements 15/25
0% Branches 0/6
0% Functions 0/4
56.52% Lines 13/23

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 501x 1x   1x 1x 1x     1x     1x       1x       1x                                     1x     1x     1x     1x    
import { model } from '@loopback/repository';
import { CompanyRegulatory, Status } from '@logchain/models';
import { DateUtils } from '@logchain/utils';
import { Expose, Transform, Type } from 'class-transformer';
import { CompanyRegulatoryHistoriesDto, CompanyDto } from '.';
import { TimeZoneTransform } from '@logchain/decorators';
 
@model({ name: 'CompanyRegulatoryDto' })
export class CompanyRegulatoryDto extends CompanyRegulatory {
  @Expose({ name: 'request_date' })
  @TimeZoneTransform()
  created_date: Date;
 
  @Expose({ name: 'start_date' })
  @TimeZoneTransform()
  duration_start: Date;
 
  @Expose({ name: 'end_date' })
  @TimeZoneTransform()
  duration_end: Date;
 
  @Expose({ name: 'status_name' })
  @Transform(({ value, obj }) => {
    switch (obj.status) {
      case Status.CompanyRegulatory.None:
        return 'None';
      case Status.CompanyRegulatory.ForValidation:
        return 'For Validation';
      case Status.CompanyRegulatory.Accepted:
        return 'Accepted';
      case Status.CompanyRegulatory.Rejected:
        return 'Rejected';
      case Status.CompanyRegulatory.Expired:
        return 'Expired';
      default:
        break;
    }
  })
  status_name: string;
 
  @Transform(({ value }) => !!value)
  regulatory_status: boolean;
 
  @Type(() => CompanyRegulatoryHistoriesDto)
  histories: CompanyRegulatoryHistoriesDto[];
 
  @Type(() => CompanyDto)
  company?: CompanyDto;
}