api history/user
This commit is contained in:
parent
63d357ea30
commit
7b480b1247
2 changed files with 65 additions and 15 deletions
|
|
@ -570,6 +570,31 @@ export class ProfileController extends Controller {
|
|||
return new HttpSuccess(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ประวัติการแก้ไขรายการทะเบียนประวัติ
|
||||
*
|
||||
* @summary ประวัติการแก้ไขรายการทะเบียนประวัติ
|
||||
*
|
||||
* @param {string} id Id โปรไฟล์
|
||||
*/
|
||||
@Get("history/user")
|
||||
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
||||
const historyProfile = await this.profileHistoryRepo.find({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
},
|
||||
where: { keycloak: request.user.sub },
|
||||
order: {
|
||||
createdAt:"ASC",
|
||||
}
|
||||
});
|
||||
|
||||
if (!historyProfile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
return new HttpSuccess(historyProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการทะเบียนประวัติ
|
||||
*
|
||||
|
|
|
|||
|
|
@ -392,6 +392,31 @@ export class ProfileEmployeeController extends Controller {
|
|||
return new HttpSuccess(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ประวัติการแก้ไขรายการทะเบียนประวัติ
|
||||
*
|
||||
* @summary ประวัติการแก้ไขรายการทะเบียนประวัติ
|
||||
*
|
||||
* @param {string} id Id โปรไฟล์
|
||||
*/
|
||||
@Get("history/user")
|
||||
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
|
||||
const historyProfile = await this.profileHistoryRepo.find({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
},
|
||||
where: { keycloak: request.user.sub },
|
||||
order: {
|
||||
createdAt: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!historyProfile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
return new HttpSuccess(historyProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดรายการทะเบียนประวัติ
|
||||
*
|
||||
|
|
@ -998,22 +1023,22 @@ export class ProfileEmployeeController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
const rootHolder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgRoot;
|
||||
const child1Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild1;
|
||||
const child2Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild2;
|
||||
const child3Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild3;
|
||||
const child4Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
const rootHolder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgRoot;
|
||||
const child1Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild1;
|
||||
const child2Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild2;
|
||||
const child3Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild3;
|
||||
const child4Holder = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.orgChild4;
|
||||
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
prefix: item.prefix,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue