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

85.29% Statements 29/34
100% Branches 0/0
0% Functions 0/5
84.38% Lines 27/32

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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 1211x 1x 1x   1x 1x 1x 1x 1x 1x 1x       1x   1x       1x     1x     1x       1x       1x     1x     1x     1x       1x       1x     1x     1x     1x     1x                                                                                                     1x            
import { model, property } from '@loopback/repository';
import { Exclude, Expose, Transform, Type } from 'class-transformer';
import { CompanyDocument } from '../models';
import { DateUtils } from '../utils/date';
import { CompanyGateGroupDto } from './company-gate-group.dto';
import { CompanyRequestDto } from './company.dto';
import { FeatureDto } from './feature.dto';
import { FlowDefaultFormDto } from './flow-default-form.dto';
import { ModuleDto } from './module.dto';
import { UserDto } from './user.dto';
import { TimeZoneTransform, UserTransform } from '@logchain/decorators';
 
@Exclude()
@model({ name: 'CompanyDocumentDto' })
export class CompanyDocumentDto extends CompanyDocument {
  @Expose()
  id: number;
 
  @Expose()
  @Type(() => CompanyRequestDto)
  company: CompanyRequestDto;
 
  @Expose()
  name: string;
 
  @Expose()
  description: string;
 
  @Expose()
  @Type(() => FeatureDto)
  feature: FeatureDto;
 
  @Expose()
  @Type(() => ModuleDto)
  module: ModuleDto;
 
  @Expose()
  status: boolean;
 
  @UserTransform('created_name', ['single'])
  creator?: UserDto;
 
  @UserTransform('modified_name', ['single'])
  modifier?: UserDto;
 
  @Expose()
  @TimeZoneTransform()
  created_date: Date;
 
  @Expose()
  @TimeZoneTransform()
  modified_date: Date;
 
  @Expose()
  form?: FlowDefaultFormDto;
 
  @Expose()
  form_builder: boolean;
 
  @Expose()
  form_detail: object;
 
  @Expose()
  is_published: boolean;
 
  @Expose()
  @Type(() => CompanyGateGroupDto)
  @property({
    type: 'array',
    required: false,
    jsonSchema: {
      type: 'array',
      items: {
        type: 'object',
        properties: {
          id: {
            type: 'number',
          },
          order: {
            type: 'number',
          },
          title: {
            type: 'string',
          },
          flag: {
            type: 'string',
            enum: ['INSERT', 'UPDATE', 'DELETE'],
            description: 'INSERT, UPDATE, DELETE',
          },
          company_gate_group_details: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                id: {
                  type: 'number',
                },
                order: {
                  type: 'number',
                },
                question: {
                  type: 'string',
                },
                flag: {
                  type: 'string',
                  enum: ['INSERT', 'UPDATE', 'DELETE'],
                },
              },
            },
          },
        },
      },
    },
  })
  company_gate_groups: CompanyGateGroupDto[];
 
  constructor(data: Partial<CompanyDocumentDto>) {
    super(data);
  }
}