mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
refactor: dtos validation
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import { AttachmentLinkDto } from '@/modules/Attachments/dtos/Attachment.dto';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsArray, ValidateNested } from 'class-validator';
|
||||
import { IsString } from 'class-validator';
|
||||
import { IsDateString, IsNumber, IsOptional } from 'class-validator';
|
||||
import { IsInt } from 'class-validator';
|
||||
|
||||
export class PaymentReceivedEntryDto {
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
id?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
index?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
paymentReceiveId?: number;
|
||||
|
||||
@IsInt()
|
||||
invoiceId: number;
|
||||
|
||||
@IsNumber()
|
||||
paymentAmount: number;
|
||||
}
|
||||
|
||||
export class CommandPaymentReceivedDto {
|
||||
@IsInt()
|
||||
customerId: number;
|
||||
|
||||
@IsDateString()
|
||||
paymentDate: Date | string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
amount?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
exchangeRate?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
referenceNo?: string;
|
||||
|
||||
@IsInt()
|
||||
depositAccountId: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
paymentReceiveNo?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
statement?: string;
|
||||
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => PaymentReceivedEntryDto)
|
||||
entries: PaymentReceivedEntryDto[];
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
branchId?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AttachmentLinkDto)
|
||||
attachments?: AttachmentLinkDto[];
|
||||
}
|
||||
|
||||
export class CreatePaymentReceivedDto extends CommandPaymentReceivedDto {}
|
||||
export class EditPaymentReceivedDto extends CommandPaymentReceivedDto {}
|
||||
Reference in New Issue
Block a user