add admin path ทะเบียนประวัติ

This commit is contained in:
AdisakKanthawilang 2024-09-03 15:08:29 +07:00
parent a7c1b2e6a9
commit 4bfecf7899
12 changed files with 205 additions and 52 deletions

View file

@ -61,17 +61,34 @@ export class ProfileAbilityController extends Controller {
return new HttpSuccess(getProfileAbilityId);
}
@Get("history/{abilityId}")
public async getProfileAbilityHistory(
@Get("admin/history/{abilityId}")
public async getProfileAbilityAdminHistory(
@Path() abilityId: string,
@Request() req: RequestWithUser,
) {
// const _record = await this.profileAbilityRepo.findOne({
// where: { id: abilityId },
// });
// if (_record) {
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
// }
const _record = await this.profileAbilityRepo.findOne({
where: { id: abilityId },
});
if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
}
const record = await this.profileAbilityHistoryRepo.find({
where: { profileAbilityId: abilityId },
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Get("history/{abilityId}")
public async getProfileAbilityHistory(
@Path() abilityId: string,
) {
const record = await this.profileAbilityHistoryRepo.find({
where: { profileAbilityId: abilityId },
order: { createdAt: "DESC" },