feat(transactions): add dto
This commit is contained in:
parent
00b0c843f9
commit
844dd81af2
1 changed files with 50 additions and 0 deletions
50
src/transactions/dto.ts
Normal file
50
src/transactions/dto.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { IsIn, IsISO8601, IsInt, IsOptional, IsString, IsUUID, Length, Min } from 'class-validator';
|
||||
|
||||
export const EVIDENCE_STATUSES = ['missing', 'partial', 'complete', 'not_required'] as const;
|
||||
export type EvidenceStatusValue = (typeof EVIDENCE_STATUSES)[number];
|
||||
|
||||
export class CreateTransactionDto {
|
||||
@IsUUID()
|
||||
organizationId!: string;
|
||||
|
||||
@IsString()
|
||||
@Length(1, 64)
|
||||
type!: string;
|
||||
|
||||
/** Valoarea in unitati minore (ex: bani in centi). NU se admit zecimale. */
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
amountMinorUnits!: number;
|
||||
|
||||
@IsString()
|
||||
@Length(3, 3)
|
||||
currency!: string;
|
||||
|
||||
@IsISO8601()
|
||||
transactionDate!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(EVIDENCE_STATUSES as unknown as string[])
|
||||
evidenceStatus?: EvidenceStatusValue;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@Length(1, 255)
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export class UpdateTransactionDto {
|
||||
@IsOptional()
|
||||
@IsIn(EVIDENCE_STATUSES as unknown as string[])
|
||||
evidenceStatus?: EvidenceStatusValue;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@Length(1, 64)
|
||||
type?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@Length(1, 255)
|
||||
source?: string;
|
||||
}
|
||||
Loading…
Reference in a new issue