permission ทะเบียนประวัติขรก.+ลูกจ้าง

This commit is contained in:
Bright 2024-08-08 17:15:21 +07:00
parent be7f719fd5
commit 9f5987d968
44 changed files with 191 additions and 75 deletions

View file

@ -6,7 +6,7 @@ import HttpError from "../interfaces/http-error";
import { RequestWithUser } from "../middlewares/user";
import { CreateProfileEmployeeAvatar, ProfileAvatar } from "../entities/ProfileAvatar";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import permission from "../interfaces/permission";
@Route("api/v1/org/profile-employee/avatar")
@Tags("ProfileAvatar")
@Security("bearerAuth")
@ -54,6 +54,7 @@ export class ProfileAvatarEmployeeController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileEmployeeAvatar,
) {
await new permission().PermissionCreate(req,"SYS_REGISTRY_EMP");
const profile = await this.profileRepository.findOne({
where: { id: body.profileEmployeeId },
});
@ -104,7 +105,8 @@ export class ProfileAvatarEmployeeController extends Controller {
}
@Delete("{avatarId}")
public async deleteAvatarEmployee(@Path() avatarId: string) {
public async deleteAvatarEmployee(@Path() avatarId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req,"SYS_REGISTRY_EMP");
const result = await this.avatarRepository.delete({ id: avatarId });
if (result.affected == undefined || result.affected <= 0) {