chore: add response example

This commit is contained in:
Methapon2001 2024-03-12 17:11:42 +07:00
parent 9c79a11047
commit 96b53a4ca5
4 changed files with 285 additions and 0 deletions

View file

@ -2,6 +2,7 @@ import {
Body,
Controller,
Delete,
Example,
Get,
Patch,
Path,
@ -27,12 +28,73 @@ export class ProfileHonorController extends Controller {
private honorHistoryRepo = AppDataSource.getRepository(ProfileHonorHistory);
@Get("{profileId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
createdAt: "2024-03-12T03:10:05.594Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-12T03:10:05.594Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
isActive: true,
detail: "string",
issueDate: "2024-03-12T10:09:47.000Z",
issuer: "string",
refCommandDate: "2024-03-12T10:09:47.000Z",
refCommandNo: "string",
isDate: true,
},
],
})
public async getHonor(@Path() profileId: string) {
const record = await this.honorRepo.findBy({ profileId });
return new HttpSuccess(record);
}
@Get("history/{honorId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "3bedb365-4a41-4df5-8f47-b6e143221d2c",
createdAt: "2024-03-12T03:11:01.395Z",
createdUserId: "00000000-0000-0000-0000-000000000000",
lastUpdatedAt: "2024-03-12T03:11:01.395Z",
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
detail: "detail",
issueDate: "2024-03-12T10:10:31.000Z",
issuer: "issuer",
refCommandDate: "2024-03-12T10:10:31.000Z",
refCommandNo: "refCommandNo",
profileHonorId: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
},
{
id: "ba0e2f82-014e-46c6-8b82-a7c28eb5325f",
createdAt: "2024-03-12T03:10:05.657Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-12T03:10:05.657Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
detail: "string",
issueDate: "2024-03-12T10:09:47.000Z",
issuer: "string",
refCommandDate: "2024-03-12T10:09:47.000Z",
refCommandNo: "string",
profileHonorId: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
},
],
})
public async honorHistory(@Path() honorId: string) {
const record = await this.honorHistoryRepo.findBy({
profileHonorId: honorId,