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,72 @@ export class ProfileCertificateController extends Controller {
private certificateHistoryRepo = AppDataSource.getRepository(ProfileCertificateHistory);
@Get("{profileId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "e1ef9c3d-079a-40d8-8332-664c3e9a5a70",
createdAt: "2024-03-12T03:02:27.532Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-12T03:02:27.532Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
expireDate: "2024-03-12T10:01:48.000Z",
isActive: true,
issueDate: "2024-03-12T10:01:48.000Z",
certificateNo: "string",
certificateType: "string",
issuer: "string",
},
],
})
public async getCertificate(@Path() profileId: string) {
const record = await this.certificateRepo.findBy({ profileId });
return new HttpSuccess(record);
}
@Get("history/{certificateId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "c0ecf986-b290-44ca-b45e-f4448cdd34dd",
createdAt: "2024-03-12T03:03:30.169Z",
createdUserId: "00000000-0000-0000-0000-000000000000",
lastUpdatedAt: "2024-03-12T03:03:30.169Z",
lastUpdateUserId: "00000000-0000-0000-0000-000000000000",
createdFullName: "string",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
expireDate: "2024-03-12T10:03:05.000Z",
isActive: true,
issueDate: "2024-03-12T10:03:05.000Z",
certificateNo: "no",
certificateType: "type",
issuer: "issuer",
profileCertificateId: "e1ef9c3d-079a-40d8-8332-664c3e9a5a70",
},
{
id: "dc4c2800-5fc5-4ec3-b19a-c4a27beac35f",
createdAt: "2024-03-12T03:02:27.583Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-12T03:02:27.583Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
expireDate: "2024-03-12T10:01:48.000Z",
isActive: true,
issueDate: "2024-03-12T10:01:48.000Z",
certificateNo: "string",
certificateType: "string",
issuer: "string",
profileCertificateId: "e1ef9c3d-079a-40d8-8332-664c3e9a5a70",
},
],
})
public async certificateHistory(@Path() certificateId: string) {
const record = await this.certificateHistoryRepo.findBy({
profileCertificateId: certificateId,