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,
@ -31,12 +32,96 @@ export class ProfileInsigniaController extends Controller {
private insigniaHistoryRepo = AppDataSource.getRepository(ProfileInsigniaHistory);
@Get("{profileId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "c9d4dd52-25f5-491a-852d-28bfe00d66cb",
createdAt: "2024-03-12T03:05:09.393Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-12T03:05:09.393Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
isActive: true,
year: 0,
no: "string",
volume: "string",
section: "string",
page: "string",
receiveDate: "2024-03-12T10:05:02.000Z",
insigniaId: "string",
insigniaType: "string",
dateAnnounce: "2024-03-12T10:05:02.000Z",
issue: "string",
volumeNo: "string",
refCommandDate: "2024-03-12T10:05:02.000Z",
refCommandNo: "string",
},
],
})
public async getInsignia(@Path() profileId: string) {
const record = await this.insigniaRepo.findBy({ profileId });
return new HttpSuccess(record);
}
@Get("history/{InsigniaId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "c363d13c-88bd-4954-adf5-70d3f5ca9c30",
createdAt: "2024-03-12T03:06:31.062Z",
createdUserId: "00000000-0000-0000-0000-000000000000",
lastUpdatedAt: "2024-03-12T03:06:31.062Z",
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
year: 0,
no: "no",
volume: "volume",
section: "section",
page: "page",
receiveDate: "2024-03-12T10:05:44.000Z",
insigniaId: "insigniaId",
insigniaType: "insigniaType",
dateAnnounce: "2024-03-12T10:05:44.000Z",
issue: "string",
volumeNo: "volumeNo",
refCommandDate: "2024-03-12T10:05:44.000Z",
refCommandNo: "refCommandNo",
profileInsigniaId: "c9d4dd52-25f5-491a-852d-28bfe00d66cb",
},
{
id: "c9d4dd52-25f5-491a-852d-28bfe00d66cb",
createdAt: "2024-03-12T03:05:09.393Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-12T03:09:04.905Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
year: 0,
no: "string",
volume: "string",
section: "string",
page: "string",
receiveDate: "2024-03-12T10:05:02.000Z",
insigniaId: "string",
insigniaType: "string",
dateAnnounce: "2024-03-12T10:05:02.000Z",
issue: "string",
volumeNo: "string",
refCommandDate: "2024-03-12T10:05:02.000Z",
refCommandNo: "string",
profileInsigniaId: "c9d4dd52-25f5-491a-852d-28bfe00d66cb",
},
],
})
public async getInsigniaHistory(@Path() InsigniaId: string) {
const record = await this.insigniaHistoryRepo.findBy({
profileInsigniaId: InsigniaId,