All files / transactions dto.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 0/0
100% Lines 14/14

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 511x   1x     1x   1x       1x         1x       1x     1x       1x         1x     1x     1x         1x         1x    
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;
}