add parth admin history

This commit is contained in:
AdisakKanthawilang 2024-09-09 18:10:01 +07:00
parent 74e64176e6
commit 4b6fd79264
23 changed files with 309 additions and 50 deletions

View file

@ -64,8 +64,8 @@ export class ProfileEducationsEmployeeTempController extends Controller {
return new HttpSuccess(getProfileEducation);
}
@Get("history/{educationId}")
public async getProfileEducationHistory(
@Get("admin/history/{educationId}")
public async getProfileAdminEducationHistory(
@Path() educationId: string,
@Request() req: RequestWithUser,
) {
@ -82,6 +82,22 @@ export class ProfileEducationsEmployeeTempController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{educationId}")
public async getProfileEducationHistory(
@Path() educationId: string,
) {
const record = await this.profileEducationHistoryRepo.find({
where: {
profileEducationId: educationId,
},
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post()
public async newProfileEducation(
@Request() req: RequestWithUser,