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

@ -63,15 +63,31 @@ export class ProfileEducationsController extends Controller {
return new HttpSuccess(getProfileEducation);
}
@Get("history/{educationId}")
public async getProfileEducationHistory(
@Get("admin/history/{educationId}")
public async getProfileEducationAdminHistory(
@Path() educationId: string,
@Request() req: RequestWithUser,
) {
// const _record = await this.profileEducationRepo.findOneBy({ id: educationId });
// if (_record) {
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
// }
const _record = await this.profileEducationRepo.findOneBy({ id: educationId });
if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
}
const record = await this.profileEducationHistoryRepo.find({
where: {
profileEducationId: educationId,
},
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Get("history/{educationId}")
public async getProfileEducationHistory(
@Path() educationId: string,
) {
const record = await this.profileEducationHistoryRepo.find({
where: {
profileEducationId: educationId,