50 lines
1 KiB
TypeScript
50 lines
1 KiB
TypeScript
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;
|
|
}
|