role เมนู ลูกจ้างประจำ กทม.

This commit is contained in:
AdisakKanthawilang 2024-08-23 16:28:31 +07:00
parent 359d22beec
commit 7237c68cb8
23 changed files with 327 additions and 155 deletions

View file

@ -73,11 +73,11 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
},
})
public async getFamilyFather(@Path() profileEmployeeId: string) {
public async getFamilyFather(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
@ -164,7 +164,8 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
},
],
})
public async familyFatherHistory(@Path() profileEmployeeId: string) {
public async familyFatherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
@ -206,7 +207,6 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileEmployeeFamilyFather,
) {
await new permission().PermissionCreate(req, "SYS_REGISTRY_EMP");
const familyFather = Object.assign(new ProfileFamilyFather(), body);
if (!familyFather) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -215,6 +215,7 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
familyFather.createdUserId = req.user.sub;
familyFather.createdFullName = req.user.name;
@ -237,7 +238,7 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
@Body() body: UpdateProfileFamilyFather,
@Path() profileEmployeeId: string,
) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_EMP");
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const familyFather = await this.ProfileFamilyFather.findOneBy({
profileEmployeeId: profileEmployeeId,
});