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

@ -55,8 +55,8 @@ export class ProfileTrainingController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{trainingId}")
public async trainingHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
@Get("admin/history/{trainingId}")
public async trainingAdminHistory(@Path() trainingId: string, @Request() req: RequestWithUser) {
const _record = await this.trainingRepo.findOneBy({ id: trainingId });
if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
@ -70,6 +70,17 @@ export class ProfileTrainingController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{trainingId}")
public async trainingHistory(@Path() trainingId: string,) {
const record = await this.trainingHistoryRepo.find({
where: {
profileTrainingId: trainingId,
},
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post()
public async newTraining(@Request() req: RequestWithUser, @Body() body: CreateProfileTraining) {
if (!body.profileId) {