|
1 | | -import { |
2 | | - IsBoolean, |
3 | | - IsDateString, |
4 | | - IsNumber, |
5 | | - IsOptional, |
6 | | - IsString, |
7 | | -} from "class-validator"; |
| 1 | +import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; |
| 2 | +import { IsBoolean, IsDateString, IsNumber, IsOptional, IsString } from "class-validator"; |
8 | 3 |
|
9 | 4 | export class CreateBillingAccountDto { |
10 | | - @IsString() name!: string; |
11 | | - @IsOptional() @IsString() projectId?: string; |
12 | | - @IsOptional() @IsString() description?: string; |
13 | | - @IsOptional() @IsString() status?: "ACTIVE" | "INACTIVE"; |
14 | | - @IsOptional() @IsDateString() startDate?: string; |
15 | | - @IsOptional() @IsDateString() endDate?: string; |
16 | | - @IsNumber() budget!: number; |
17 | | - @IsNumber() markup!: number; |
18 | | - @IsString() clientId!: string; |
19 | | - @IsOptional() @IsString() poNumber?: string; |
20 | | - @IsOptional() @IsString() subscriptionNumber?: string; |
21 | | - @IsOptional() @IsBoolean() isManualPrize?: boolean; |
22 | | - @IsOptional() @IsString() paymentTerms?: string; |
23 | | - @IsOptional() @IsNumber() salesTax?: number; |
24 | | - @IsOptional() @IsBoolean() billable?: boolean; |
| 5 | + @ApiProperty({ example: "Acme Innovation Billing Account" }) |
| 6 | + @IsString() |
| 7 | + name!: string; |
| 8 | + |
| 9 | + @ApiPropertyOptional({ example: "218734" }) |
| 10 | + @IsOptional() |
| 11 | + @IsString() |
| 12 | + projectId?: string; |
| 13 | + |
| 14 | + @ApiPropertyOptional({ example: "Primary billing account for Acme Innovation initiatives." }) |
| 15 | + @IsOptional() |
| 16 | + @IsString() |
| 17 | + description?: string; |
| 18 | + |
| 19 | + @ApiPropertyOptional({ enum: ["ACTIVE", "INACTIVE"], example: "ACTIVE" }) |
| 20 | + @IsOptional() |
| 21 | + @IsString() |
| 22 | + status?: "ACTIVE" | "INACTIVE"; |
| 23 | + |
| 24 | + @ApiPropertyOptional({ example: "2025-01-01T00:00:00.000Z" }) |
| 25 | + @IsOptional() |
| 26 | + @IsDateString() |
| 27 | + startDate?: string; |
| 28 | + |
| 29 | + @ApiPropertyOptional({ example: "2025-12-31T23:59:59.000Z" }) |
| 30 | + @IsOptional() |
| 31 | + @IsDateString() |
| 32 | + endDate?: string; |
| 33 | + |
| 34 | + @ApiProperty({ example: 250000 }) |
| 35 | + @IsNumber() |
| 36 | + budget!: number; |
| 37 | + |
| 38 | + @ApiProperty({ example: 0.15 }) |
| 39 | + @IsNumber() |
| 40 | + markup!: number; |
| 41 | + |
| 42 | + @ApiProperty({ example: "client-123456" }) |
| 43 | + @IsString() |
| 44 | + clientId!: string; |
| 45 | + |
| 46 | + @ApiPropertyOptional({ example: "PO-456789" }) |
| 47 | + @IsOptional() |
| 48 | + @IsString() |
| 49 | + poNumber?: string; |
| 50 | + |
| 51 | + @ApiPropertyOptional({ example: "SUB-2024-001" }) |
| 52 | + @IsOptional() |
| 53 | + @IsString() |
| 54 | + subscriptionNumber?: string; |
| 55 | + |
| 56 | + @ApiPropertyOptional({ example: false }) |
| 57 | + @IsOptional() |
| 58 | + @IsBoolean() |
| 59 | + isManualPrize?: boolean; |
| 60 | + |
| 61 | + @ApiPropertyOptional({ example: "Net 30" }) |
| 62 | + @IsOptional() |
| 63 | + @IsString() |
| 64 | + paymentTerms?: string; |
| 65 | + |
| 66 | + @ApiPropertyOptional({ example: 8.75 }) |
| 67 | + @IsOptional() |
| 68 | + @IsNumber() |
| 69 | + salesTax?: number; |
| 70 | + |
| 71 | + @ApiPropertyOptional({ example: true }) |
| 72 | + @IsOptional() |
| 73 | + @IsBoolean() |
| 74 | + billable?: boolean; |
25 | 75 | } |
0 commit comments