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

@ -51,8 +51,8 @@ export class ProfileDutyController extends Controller {
return new HttpSuccess(lists);
}
@Get("history/{dutyId}")
public async dutyHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
@Get("admin/history/{dutyId}")
public async dutyAdminHistory(@Path() dutyId: string, @Request() req: RequestWithUser) {
const _record = await this.dutyRepository.findOneBy({ id: dutyId });
if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
@ -64,6 +64,15 @@ export class ProfileDutyController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{dutyId}")
public async dutyHistory(@Path() dutyId: string,) {
const record = await this.dutyHistoryRepository.find({
where: { profileDutyId: dutyId },
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
}
@Post()
public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileDuty) {
if (!body.profileId) {