chore: add response example
This commit is contained in:
parent
9c79a11047
commit
96b53a4ca5
4 changed files with 285 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import {
|
|||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
Path,
|
||||
|
|
@ -31,12 +32,88 @@ export class ProfileTrainingController extends Controller {
|
|||
private trainingHistoryRepo = AppDataSource.getRepository(ProfileTrainingHistory);
|
||||
|
||||
@Get("{profileId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
message: "สำเร็จ",
|
||||
result: [
|
||||
{
|
||||
id: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
|
||||
createdAt: "2024-03-12T02:55:56.915Z",
|
||||
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
lastUpdatedAt: "2024-03-12T02:55:56.915Z",
|
||||
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
createdFullName: "สาวิตรี ศรีสมัย",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
isActive: true,
|
||||
startDate: "2024-03-12T09:55:23.000Z",
|
||||
endDate: "2024-03-12T09:55:23.000Z",
|
||||
numberOrder: "string",
|
||||
topic: "string",
|
||||
place: "string",
|
||||
dateOrder: "2024-03-12T09:55:23.000Z",
|
||||
department: "string",
|
||||
duration: "string",
|
||||
name: "string",
|
||||
yearly: 0,
|
||||
isDate: true,
|
||||
},
|
||||
],
|
||||
})
|
||||
public async getTraining(@Path() profileId: string) {
|
||||
const record = await this.trainingRepo.findBy({ profileId });
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Get("history/{trainingId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
message: "สำเร็จ",
|
||||
result: [
|
||||
{
|
||||
id: "6d4e9dbe-8697-4546-9651-0a1c3ea0a82d",
|
||||
createdAt: "2024-03-12T02:55:56.971Z",
|
||||
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
lastUpdatedAt: "2024-03-12T02:55:56.971Z",
|
||||
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
createdFullName: "สาวิตรี ศรีสมัย",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
isActive: true,
|
||||
startDate: "2024-03-12T09:55:23.000Z",
|
||||
endDate: "2024-03-12T09:55:23.000Z",
|
||||
numberOrder: "string",
|
||||
topic: "string",
|
||||
place: "string",
|
||||
dateOrder: "2024-03-12T09:55:23.000Z",
|
||||
department: "string",
|
||||
duration: "string",
|
||||
name: "string",
|
||||
yearly: 0,
|
||||
profileTrainingId: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
|
||||
},
|
||||
{
|
||||
id: "a251c176-3dac-4d09-9813-38c8db1127e3",
|
||||
createdAt: "2024-03-12T02:58:17.917Z",
|
||||
createdUserId: "00000000-0000-0000-0000-000000000000",
|
||||
lastUpdatedAt: "2024-03-12T02:58:17.917Z",
|
||||
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
|
||||
createdFullName: "string",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
isActive: true,
|
||||
startDate: "2024-03-12T09:57:44.000Z",
|
||||
endDate: "2024-03-12T09:57:44.000Z",
|
||||
numberOrder: "string",
|
||||
topic: "topic",
|
||||
place: "place",
|
||||
dateOrder: "2024-03-12T09:57:44.000Z",
|
||||
department: "department",
|
||||
duration: "string",
|
||||
name: "name",
|
||||
yearly: 0,
|
||||
profileTrainingId: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
|
||||
},
|
||||
],
|
||||
})
|
||||
public async trainingHistory(@Path() trainingId: string) {
|
||||
const record = await this.trainingHistoryRepo.findBy({
|
||||
profileTrainingId: trainingId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue