mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
125 lines
2.7 KiB
TypeScript
125 lines
2.7 KiB
TypeScript
import { AttachmentLinkDto } from '@/modules/Attachments/dtos/Attachment.dto';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { IsArray, IsNotEmpty, 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()
|
|
@IsNotEmpty()
|
|
@ApiProperty({ description: 'The id of the customer', example: 1 })
|
|
customerId: number;
|
|
|
|
@IsDateString()
|
|
@ApiProperty({
|
|
description: 'The payment date of the payment received',
|
|
example: '2021-01-01',
|
|
})
|
|
paymentDate: Date | string;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@ApiProperty({
|
|
description: 'The amount of the payment received',
|
|
example: 100,
|
|
})
|
|
amount?: number;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@ApiProperty({
|
|
description: 'The exchange rate of the payment received',
|
|
example: 1,
|
|
})
|
|
exchangeRate?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiProperty({
|
|
description: 'The reference number of the payment received',
|
|
example: '123456',
|
|
})
|
|
referenceNo?: string;
|
|
|
|
@IsInt()
|
|
@IsNotEmpty()
|
|
@ApiProperty({
|
|
description: 'The id of the deposit account',
|
|
example: 1,
|
|
})
|
|
depositAccountId: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiProperty({
|
|
description: 'The payment receive number of the payment received',
|
|
example: '123456',
|
|
})
|
|
paymentReceiveNo?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiProperty({
|
|
description: 'The statement of the payment received',
|
|
example: '123456',
|
|
})
|
|
statement?: string;
|
|
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => PaymentReceivedEntryDto)
|
|
@ApiProperty({
|
|
description: 'The entries of the payment received',
|
|
example: [{ invoiceId: 1, paymentAmount: 100 }],
|
|
})
|
|
entries: PaymentReceivedEntryDto[];
|
|
|
|
@IsOptional()
|
|
@IsInt()
|
|
@ApiProperty({
|
|
description: 'The id of the branch',
|
|
example: 1,
|
|
})
|
|
branchId?: number;
|
|
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => AttachmentLinkDto)
|
|
@ApiProperty({
|
|
description: 'The attachments of the payment received',
|
|
example: [
|
|
{
|
|
id: 1,
|
|
type: 'bill',
|
|
},
|
|
],
|
|
})
|
|
attachments?: AttachmentLinkDto[];
|
|
}
|
|
|
|
export class CreatePaymentReceivedDto extends CommandPaymentReceivedDto {}
|
|
export class EditPaymentReceivedDto extends CommandPaymentReceivedDto {}
|