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 { Profile } from "../entities/Profile";
import { CreateProfileAvatar, ProfileAvatar } from "../entities/ProfileAvatar";
import permission from "../interfaces/permission";
@Route("api/v1/org/profile/avatar")
@Tags("ProfileAvatar")
@Security("bearerAuth")
@ -63,6 +63,7 @@ export class ProfileAvatarController extends Controller {
@Post()
public async newAvatar(@Request() req: RequestWithUser, @Body() body: CreateProfileAvatar) {
await new permission().PermissionCreate(req,"SYS_REGISTRY");
const profile = await this.profileRepository.findOne({
where: { id: body.profileId },
});
@ -113,7 +114,8 @@ export class ProfileAvatarController extends Controller {
}
@Delete("{avatarId}")
public async deleteAvatar(@Path() avatarId: string) {
public async deleteAvatar(@Path() avatarId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req,"SYS_REGISTRY");
const result = await this.avatarRepository.delete({ id: avatarId });
if (result.affected == undefined || result.affected <= 0) {