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,7 +73,8 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
},
})
public async getFamilyMother(@Path() profileEmployeeId: string) {
public async getFamilyMother(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
@ -164,14 +165,14 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
},
],
})
public async familyMotherHistory(@Path() profileEmployeeId: string) {
public async familyMotherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const familyMother = await this.ProfileFamilyMother.find({
relations: ["histories"],
order: { lastUpdatedAt: "DESC" },
@ -206,7 +207,6 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileEmployeeFamilyMother,
) {
await new permission().PermissionCreate(req, "SYS_REGISTRY_EMP");
const familyMother = Object.assign(new ProfileFamilyMother(), body);
if (!familyMother) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -215,6 +215,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_EMP", profile.id);
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
familyMother.createdUserId = req.user.sub;
familyMother.createdFullName = req.user.name;
@ -237,7 +238,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
@Body() body: UpdateProfileFamilyMother,
@Path() profileEmployeeId: string,
) {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_EMP");
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const familyMother = await this.ProfileFamilyMother.findOneBy({
profileEmployeeId: profileEmployeeId,
});