Skip to content

Commit 32fdb5f

Browse files
committed
Updated examples for SFDC work
1 parent cd2a5b6 commit 32fdb5f

File tree

6 files changed

+154
-36
lines changed

6 files changed

+154
-36
lines changed

src/billing-accounts/billing-accounts.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,14 @@ export class BillingAccountsController {
213213
properties: { userId: { type: 'string' } },
214214
required: ['userId'],
215215
},
216+
userId: { type: 'string' },
216217
},
217218
required: ['param'],
219+
example: {
220+
param: {
221+
userId: "12345678",
222+
},
223+
},
218224
},
219225
})
220226
async addUser(
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import { ApiProperty } from "@nestjs/swagger";
12
import { IsNumber, IsString } from "class-validator";
23

34
export class ConsumeAmountDto {
4-
@IsString() challengeId!: string;
5-
@IsNumber() amount!: number;
5+
@ApiProperty({ example: "12345abcde" })
6+
@IsString()
7+
challengeId!: string;
8+
9+
@ApiProperty({ example: 1500 })
10+
@IsNumber()
11+
amount!: number;
612
}
Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,75 @@
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";
83

94
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;
2575
}
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import { ApiProperty } from "@nestjs/swagger";
12
import { IsNumber, IsString } from "class-validator";
23

34
export class LockAmountDto {
4-
@IsString() challengeId!: string;
5-
@IsNumber() amount!: number; // if 0, unlock
5+
@ApiProperty({ example: "12345abcde" })
6+
@IsString()
7+
challengeId!: string;
8+
9+
@ApiProperty({ example: 1500 })
10+
@IsNumber()
11+
amount!: number; // if 0, unlock
612
}

src/clients/dto/create-client.dto.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
1+
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
12
import { IsDateString, IsIn, IsOptional, IsString, ValidateNested } from "class-validator";
23
import { Type } from "class-transformer";
34

45
export class CreateClientDto {
5-
@IsString() name!: string;
6-
@IsOptional() @IsString() codeName?: string;
7-
@IsOptional() @IsIn(["ACTIVE", "INACTIVE"]) status?: "ACTIVE" | "INACTIVE";
8-
@IsOptional() @IsDateString() startDate?: string;
9-
@IsOptional() @IsDateString() endDate?: string;
6+
@ApiProperty({ example: "Acme Corporation" })
7+
@IsString()
8+
name!: string;
9+
10+
@ApiPropertyOptional({ example: "Acme R&D" })
11+
@IsOptional()
12+
@IsString()
13+
codeName?: string;
14+
15+
@ApiPropertyOptional({ enum: ["ACTIVE", "INACTIVE"], example: "ACTIVE" })
16+
@IsOptional()
17+
@IsIn(["ACTIVE", "INACTIVE"])
18+
status?: "ACTIVE" | "INACTIVE";
19+
20+
@ApiPropertyOptional({ example: "2024-05-01T00:00:00.000Z" })
21+
@IsOptional()
22+
@IsDateString()
23+
startDate?: string;
24+
25+
@ApiPropertyOptional({ example: "2025-05-01T00:00:00.000Z" })
26+
@IsOptional()
27+
@IsDateString()
28+
endDate?: string;
1029
}
1130

1231
export class CreateClientRequestDto {
1332
// Request body shape: { "param": { ...CreateClientDto } }
33+
@ApiProperty({
34+
example: {
35+
param: {
36+
name: "Acme Corporation",
37+
codeName: "Acme R&D",
38+
status: "ACTIVE",
39+
startDate: "2024-05-01T00:00:00.000Z",
40+
endDate: "2025-05-01T00:00:00.000Z",
41+
},
42+
},
43+
})
1444
@ValidateNested()
1545
@Type(() => CreateClientDto)
1646
param!: CreateClientDto;
Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
1+
import { ApiPropertyOptional } from "@nestjs/swagger";
12
import { IsDateString, IsIn, IsOptional, IsString } from "class-validator";
23

34
export class UpdateClientDto {
4-
@IsOptional() @IsString() name?: string;
5-
@IsOptional() @IsString() codeName?: string;
6-
@IsOptional() @IsIn(["ACTIVE", "INACTIVE"]) status?: "ACTIVE" | "INACTIVE";
7-
@IsOptional() @IsDateString() startDate?: string;
8-
@IsOptional() @IsDateString() endDate?: string;
5+
@ApiPropertyOptional({ example: "Acme Corporation" })
6+
@IsOptional()
7+
@IsString()
8+
name?: string;
9+
10+
@ApiPropertyOptional({ example: "Acme R&D" })
11+
@IsOptional()
12+
@IsString()
13+
codeName?: string;
14+
15+
@ApiPropertyOptional({ enum: ["ACTIVE", "INACTIVE"], example: "INACTIVE" })
16+
@IsOptional()
17+
@IsIn(["ACTIVE", "INACTIVE"])
18+
status?: "ACTIVE" | "INACTIVE";
19+
20+
@ApiPropertyOptional({ example: "2024-07-01T00:00:00.000Z" })
21+
@IsOptional()
22+
@IsDateString()
23+
startDate?: string;
24+
25+
@ApiPropertyOptional({ example: "2025-07-01T00:00:00.000Z" })
26+
@IsOptional()
27+
@IsDateString()
28+
endDate?: string;
929
}

0 commit comments

Comments
 (0)