chore: update response example

This commit is contained in:
Methapon2001 2024-03-19 19:47:12 +07:00
parent 88b567070a
commit 3858ea1415

View file

@ -41,9 +41,78 @@ export class ProfileFamilyHistoryController extends Controller {
status: 200, status: 200,
message: "สำเร็จ", message: "สำเร็จ",
result: { result: {
status: 200, id: "6207ae29-05ef-4abb-9a37-a887265d671e",
message: "สำเร็จ", createdAt: "2024-03-19T11:00:29.769Z",
result: { createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-19T11:00:29.769Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
couple: true,
couplePrefix: "string",
coupleFirstName: "string",
coupleLastName: "string",
coupleLastNameOld: "string",
coupleCareer: "string",
coupleCitizenId: "string",
coupleLive: true,
fatherPrefix: "string",
fatherFirstName: "string",
fatherLastName: "string",
fatherCareer: "string",
fatherCitizenId: "string",
fatherLive: true,
motherPrefix: "string",
motherFirstName: "string",
motherLastName: "string",
motherCareer: "string",
motherCitizenId: "string",
motherLive: true,
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
children: [
{
id: "9717f95a-cd20-4edb-a8b9-443c1dd99f90",
createdAt: "2024-03-19T11:00:29.785Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-19T11:00:29.785Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true,
childrenCareer: "string",
childrenFirstName: "string",
childrenLastName: "string",
childrenPrefix: "string",
childrenLive: "string",
childrenCitizenId: "string",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
},
],
},
})
public async getFamilyHistory(@Path() profileId: string) {
const family = await this.familyHistoryRepo.find({
take: 1,
order: { createdAt: "DESC" },
where: { profileId },
});
const children = await this.childrenRepo.find({
order: { createdAt: "DESC" },
where: { profileId },
});
return new HttpSuccess({
...family[0],
children,
});
}
@Get("history/{profileId}")
@Example({
status: 200,
message: "สำเร็จ",
result: [
{
id: "6207ae29-05ef-4abb-9a37-a887265d671e", id: "6207ae29-05ef-4abb-9a37-a887265d671e",
createdAt: "2024-03-19T11:00:29.769Z", createdAt: "2024-03-19T11:00:29.769Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
@ -75,47 +144,78 @@ export class ProfileFamilyHistoryController extends Controller {
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
children: [ children: [
{ {
id: "9717f95a-cd20-4edb-a8b9-443c1dd99f90", id: "980835f8-d766-4b6b-b7dc-1726db889352",
createdAt: "2024-03-19T11:00:29.785Z", createdAt: "2024-03-19T12:42:11.437Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-19T11:00:29.785Z", lastUpdatedAt: "2024-03-19T12:42:11.437Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0", lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย", createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย", lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: true, isActive: false,
childrenCareer: "string", childrenCareer: "hey",
childrenFirstName: "string", childrenFirstName: "hey",
childrenLastName: "string", childrenLastName: "hey",
childrenPrefix: "string", childrenPrefix: "hey",
childrenLive: "string", childrenLive: "hey",
childrenCitizenId: "string", childrenCitizenId: "hey",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201", profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
profileFamilyHistoryId: "6207ae29-05ef-4abb-9a37-a887265d671e",
profileChildrenId: "222db098-3f08-4d0b-ac58-7914fa41032b",
},
{
id: "cd539e67-3f34-4b8c-a9da-b7eb193fa0b4",
createdAt: "2024-03-19T12:42:11.438Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-03-19T12:42:11.438Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
isActive: false,
childrenCareer: "ay",
childrenFirstName: "ay",
childrenLastName: "ay",
childrenPrefix: "ay",
childrenLive: "ay",
childrenCitizenId: "ay",
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
profileFamilyHistoryId: "6207ae29-05ef-4abb-9a37-a887265d671e",
profileChildrenId: "d0495491-9e9f-4d2e-bc3b-c2833955fa12",
}, },
], ],
}, },
}, {
}) id: "60bbf8d1-f674-4d88-b3fb-b5603e408319",
public async getFamilyHistory(@Path() profileId: string) { createdAt: "2024-03-19T11:00:29.769Z",
const family = await this.familyHistoryRepo.find({ createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
take: 1, lastUpdatedAt: "2024-03-19T11:00:29.769Z",
order: { createdAt: "DESC" }, lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
where: { profileId }, createdFullName: "สาวิตรี ศรีสมัย",
}); lastUpdateFullName: "สาวิตรี ศรีสมัย",
const children = await this.childrenRepo.find({ isActive: true,
order: { createdAt: "DESC" }, couple: true,
where: { profileId }, couplePrefix: "string",
}); coupleFirstName: "string",
return new HttpSuccess({ coupleLastName: "string",
...family[0], coupleLastNameOld: "string",
children, coupleCareer: "yeah",
}); coupleCitizenId: "yeah",
} coupleLive: true,
fatherPrefix: "yeah",
@Get("history/{profileId}") fatherFirstName: "haaa",
@Example({ fatherLastName: "yeah",
status: 200, fatherCareer: "haaa",
message: "สำเร็จ", fatherCitizenId: "yeah",
result: [], fatherLive: true,
motherPrefix: "string",
motherFirstName: "string",
motherLastName: "string",
motherCareer: "string",
motherCitizenId: "string",
motherLive: true,
profileId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
children: [],
},
],
}) })
public async familyHistory(@Path() profileId: string) { public async familyHistory(@Path() profileId: string) {
const family = await this.familyHistoryRepo.find({ const family = await this.familyHistoryRepo.find({