All files / libs/tenants/companies/core/src/lib/dto createCompany.dto.ts

100% Statements 68/68
33.33% Branches 2/6
100% Functions 1/1
100% Lines 68/68

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 691x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x  
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsBoolean, IsEnum, IsNotEmpty, IsOptional, ValidateNested } from 'class-validator';
 
import { CurrencySymbolsEnum } from '@amalia/ext/iso-4217';
import { PeriodFrequencyEnum } from '@amalia/payout-definition/periods/types';
import { CompanyStatus, type CompanyCustomization, type CreateCompanyRequest } from '@amalia/tenants/companies/types';
 
import { CompanyCustomizationDto } from './companyCustomization.dto';
import { CreateUserDto } from './createUser.dto';
 
export class CreateCompanyDto implements CreateCompanyRequest {
  @ApiProperty()
  @IsNotEmpty()
  public readonly name!: string;
 
  @ApiProperty()
  @IsNotEmpty()
  public readonly slug!: string;
 
  @ApiProperty({ enum: PeriodFrequencyEnum, default: PeriodFrequencyEnum.month })
  @IsEnum(PeriodFrequencyEnum)
  public readonly statementFrequency!: PeriodFrequencyEnum;
 
  @ApiProperty({ enum: CurrencySymbolsEnum, default: 'EUR' })
  @IsEnum(CurrencySymbolsEnum)
  public readonly currency!: CurrencySymbolsEnum;
 
  @ApiProperty({ enum: CurrencySymbolsEnum, example: [], type: 'array' })
  @IsEnum(CurrencySymbolsEnum, { each: true })
  public readonly symbols!: CurrencySymbolsEnum[];
 
  @ApiProperty({ enum: CompanyStatus })
  @IsOptional()
  @IsEnum(CompanyStatus)
  public readonly status!: CompanyStatus;
 
  @ApiProperty()
  @IsOptional()
  @ValidateNested()
  @Type(() => CreateUserDto)
  public readonly admin!: CreateUserDto;
 
  @ApiProperty({ default: false })
  @IsBoolean()
  @IsOptional()
  public readonly loadSampleData!: boolean;
 
  @ApiProperty({ default: false })
  @IsBoolean()
  @IsOptional()
  public readonly createCommonFiltersAndQuotas!: boolean;
 
  @ApiProperty({ default: false })
  @IsBoolean()
  @IsOptional()
  public readonly runCalculation: boolean = false;
 
  @ApiProperty({ default: true })
  @IsBoolean()
  @IsOptional()
  public readonly enableTracking!: boolean;
 
  @ApiProperty({ default: false })
  @ValidateNested()
  @Type(() => CompanyCustomizationDto)
  public readonly customization!: CompanyCustomization;
}