permission ทะเบียนประวัติขรก.+ลูกจ้าง
This commit is contained in:
parent
be7f719fd5
commit
9f5987d968
44 changed files with 191 additions and 75 deletions
|
|
@ -24,7 +24,7 @@ import HttpError from "../interfaces/http-error";
|
|||
import { ProfileCertificateHistory } from "../entities/ProfileCertificateHistory";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile } from "../entities/Profile";
|
||||
|
||||
import permission from "../interfaces/permission";
|
||||
@Route("api/v1/org/profile/certificate")
|
||||
@Tags("ProfileCertificate")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -122,6 +122,7 @@ export class ProfileCertificateController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileCertificate,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -154,6 +155,7 @@ export class ProfileCertificateController extends Controller {
|
|||
@Body() body: UpdateProfileCertificate,
|
||||
@Path() certificateId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
const record = await this.certificateRepo.findOneBy({ id: certificateId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -175,7 +177,8 @@ export class ProfileCertificateController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{certificateId}")
|
||||
public async deleteCertificate(@Path() certificateId: string) {
|
||||
public async deleteCertificate(@Path() certificateId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await this.certificateHistoryRepo.delete({
|
||||
profileCertificateId: certificateId,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue