แก้ชื่อสิท
This commit is contained in:
parent
828dd2a37d
commit
ab138c2e04
23 changed files with 77 additions and 67 deletions
|
|
@ -133,7 +133,7 @@ export class ProfileAbilityController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileAbility,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ export class ProfileAbilityController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() abilityId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -186,12 +186,12 @@ export class ProfileAbilityController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{abilityId}")
|
||||
public async deleteProfileAbility(@Path() abilityId: string, @Request() req: RequestWithUser,) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
public async deleteProfileAbility(@Path() abilityId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.profileAbilityHistoryRepo.delete({
|
||||
profileAbilityId: abilityId,
|
||||
});
|
||||
|
||||
|
||||
const result = await this.profileAbilityRepo.delete({ id: abilityId });
|
||||
|
||||
if (result.affected == undefined || result.affected <= 0)
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export class ProfileAddressController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.profileRepo.findOneBy({ id: profileId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export class ProfileAssessmentsController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileAssessment,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ export class ProfileAssessmentsController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() assessmentId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -197,8 +197,11 @@ export class ProfileAssessmentsController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{assessmentId}")
|
||||
public async deleteProfileAssessment(@Path() assessmentId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
public async deleteProfileAssessment(
|
||||
@Path() assessmentId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.profileAssessmentsHistoryRepository.delete({
|
||||
profileAssessmentId: assessmentId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export class ProfileAvatarController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newAvatar(@Request() req: RequestWithUser, @Body() body: CreateProfileAvatar) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id: body.profileId },
|
||||
});
|
||||
|
|
@ -115,7 +115,7 @@ export class ProfileAvatarController extends Controller {
|
|||
|
||||
@Delete("{avatarId}")
|
||||
public async deleteAvatar(@Path() avatarId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
const result = await this.avatarRepository.delete({ id: avatarId });
|
||||
|
||||
if (result.affected == undefined || result.affected <= 0) {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ export class ProfileCertificateController extends Controller {
|
|||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
|
||||
@Get("history/{certificateId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
@ -122,7 +121,7 @@ export class ProfileCertificateController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileCertificate,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -155,7 +154,7 @@ export class ProfileCertificateController extends Controller {
|
|||
@Body() body: UpdateProfileCertificate,
|
||||
@Path() certificateId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.certificateRepo.findOneBy({ id: certificateId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -178,7 +177,7 @@ export class ProfileCertificateController extends Controller {
|
|||
|
||||
@Delete("{certificateId}")
|
||||
public async deleteCertificate(@Path() certificateId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.certificateHistoryRepo.delete({
|
||||
profileCertificateId: certificateId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileChangeName,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ export class ProfileChangeNameController extends Controller {
|
|||
@Body() body: UpdateProfileChangeName,
|
||||
@Path() changeNameId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.changeNameRepository.findOneBy({ id: changeNameId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -214,8 +214,8 @@ export class ProfileChangeNameController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{changeNameId}")
|
||||
public async deleteTraning(@Path() changeNameId: string, @Request() req: RequestWithUser,) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
public async deleteTraning(@Path() changeNameId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.changeNameHistoryRepository.delete({
|
||||
profileChangeNameId: changeNameId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export class ProfileChildrenController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newChildren(@Request() req: RequestWithUser, @Body() body: CreateProfileChildren) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
const profile = await this.profileRepository.findOneBy({ id: body.profileId });
|
||||
|
||||
if (!profile) {
|
||||
|
|
@ -108,7 +108,7 @@ export class ProfileChildrenController extends Controller {
|
|||
@Body() body: UpdateProfileChildren,
|
||||
@Path() childrenId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.childrenRepository.findOneBy({ id: childrenId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -135,8 +135,8 @@ export class ProfileChildrenController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{childrenId}")
|
||||
public async deleteTraning(@Path() childrenId: string, @Request() req: RequestWithUser,) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
public async deleteTraning(@Path() childrenId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.childrenHistoryRepository.delete({
|
||||
profileChildrenId: childrenId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2277,7 +2277,7 @@ export class ProfileController extends Controller {
|
|||
@Path() id: string,
|
||||
@Body() body: UpdateProfile,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(request, "SYS_REGISTRY_OFFICER");
|
||||
const exists =
|
||||
!!body.citizenId &&
|
||||
(await this.profileRepo.findOne({
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ export class ProfileDisciplineController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileDiscipline,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ export class ProfileDisciplineController extends Controller {
|
|||
@Body() body: UpdateProfileDiscipline,
|
||||
@Path() disciplineId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.disciplineRepository.findOneBy({ id: disciplineId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -180,7 +180,7 @@ export class ProfileDisciplineController extends Controller {
|
|||
|
||||
@Delete("{disciplineId}")
|
||||
public async deleteDiscipline(@Path() disciplineId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.disciplineHistoryRepository.delete({
|
||||
profileDisciplineId: disciplineId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ export class ProfileDutyController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newDuty(@Request() req: RequestWithUser, @Body() body: CreateProfileDuty) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ export class ProfileDutyController extends Controller {
|
|||
@Body() body: UpdateProfileDuty,
|
||||
@Path() dutyId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.dutyRepository.findOneBy({ id: dutyId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -181,7 +181,7 @@ export class ProfileDutyController extends Controller {
|
|||
|
||||
@Delete("{dutyId}")
|
||||
public async deleteDuty(@Path() dutyId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.dutyHistoryRepository.delete({
|
||||
profileDutyId: dutyId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ export class ProfileEducationsController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEducation,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ export class ProfileEducationsController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Path() educationId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.profileEducationRepo.findOneBy({ id: educationId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -234,8 +234,11 @@ export class ProfileEducationsController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{educationId}")
|
||||
public async deleteProfileEducation(@Path() educationId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
public async deleteProfileEducation(
|
||||
@Path() educationId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.profileEducationHistoryRepo.delete({
|
||||
profileEducationId: educationId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ export class ProfileFamilyCoupleController extends Controller {
|
|||
|
||||
return new HttpSuccess(mapData);
|
||||
}
|
||||
|
||||
|
||||
@Get("history/{profileId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
|
|
@ -220,7 +220,7 @@ export class ProfileFamilyCoupleController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileFamilyCouple,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
const familyCouple = Object.assign(new ProfileFamilyCouple(), body);
|
||||
if (!familyCouple) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -267,7 +267,7 @@ export class ProfileFamilyCoupleController extends Controller {
|
|||
@Body() body: UpdateProfileFamilyCouple,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const familyCouple = await this.ProfileFamilyCouple.findOneBy({ profileId: profileId });
|
||||
if (!familyCouple) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileFamilyFather,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
const familyFather = Object.assign(new ProfileFamilyFather(), body);
|
||||
if (!familyFather) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -247,7 +247,7 @@ export class ProfileFamilyFatherController extends Controller {
|
|||
@Body() body: UpdateProfileFamilyFather,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const familyFather = await this.ProfileFamilyFather.findOneBy({ profileId: profileId });
|
||||
if (!familyFather) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ export class ProfileFamilyMotherController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileFamilyMother,
|
||||
) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
const familyMother = Object.assign(new ProfileFamilyMother(), body);
|
||||
if (!familyMother) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -247,7 +247,7 @@ export class ProfileFamilyMotherController extends Controller {
|
|||
@Body() body: UpdateProfileFamilyMother,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const familyMother = await this.ProfileFamilyMother.findOneBy({ profileId: profileId });
|
||||
if (!familyMother) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
@Body() body: UpdateProfileGovernment,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ export class ProfileHonorController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newHonor(@Request() req: RequestWithUser, @Body() body: CreateProfileHonor) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ export class ProfileHonorController extends Controller {
|
|||
@Body() body: UpdateProfileHonor,
|
||||
@Path() honorId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.honorRepo.findOneBy({ id: honorId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -191,7 +191,7 @@ export class ProfileHonorController extends Controller {
|
|||
|
||||
@Delete("{honorId}")
|
||||
public async deleteTraning(@Path() honorId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.honorHistoryRepo.delete({
|
||||
profileHonorId: honorId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ export class ProfileInsigniaController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newInsignia(@Request() req: RequestWithUser, @Body() body: CreateProfileInsignia) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ export class ProfileInsigniaController extends Controller {
|
|||
@Body() body: UpdateProfileInsignia,
|
||||
@Path() insigniaId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.insigniaRepo.findOneBy({ id: insigniaId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -233,7 +233,7 @@ export class ProfileInsigniaController extends Controller {
|
|||
|
||||
@Delete("{insigniaId}")
|
||||
public async deleteInsignia(@Path() insigniaId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.insigniaHistoryRepo.delete({
|
||||
profileInsigniaId: insigniaId,
|
||||
});
|
||||
|
|
@ -248,7 +248,10 @@ export class ProfileInsigniaController extends Controller {
|
|||
}
|
||||
|
||||
@Post("dump-db")
|
||||
public async newInsigniaDumpDB(@Request() req: RequestWithUser, @Body() body: CreateProfileInsignia) {
|
||||
public async newInsigniaDumpDB(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileInsignia,
|
||||
) {
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -276,7 +279,7 @@ export class ProfileInsigniaController extends Controller {
|
|||
};
|
||||
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
data.insigniaId = insignia.id
|
||||
data.insigniaId = insignia.id;
|
||||
await this.insigniaRepo.save(data);
|
||||
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ export class ProfileLeaveController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newLeave(@Request() req: RequestWithUser, @Body() body: CreateProfileLeave) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@ export class ProfileLeaveController extends Controller {
|
|||
@Body() body: UpdateProfileLeave,
|
||||
@Path() leaveId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.leaveRepo.findOneBy({ id: leaveId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -313,7 +313,7 @@ export class ProfileLeaveController extends Controller {
|
|||
|
||||
@Delete("{leaveId}")
|
||||
public async deleteLeave(@Path() leaveId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.leaveHistoryRepo.delete({
|
||||
profileLeaveId: leaveId,
|
||||
});
|
||||
|
|
@ -339,7 +339,7 @@ export class ProfileLeaveController extends Controller {
|
|||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const leaveType = await this.leaveTypeRepository.findOne({
|
||||
where: { name: body.leaveTypeId }
|
||||
where: { name: body.leaveTypeId },
|
||||
});
|
||||
if (!leaveType) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลประเภทลานี้");
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export class ProfileNopaidController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newNopaid(@Request() req: RequestWithUser, @Body() body: CreateProfileNopaid) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ export class ProfileNopaidController extends Controller {
|
|||
@Body() body: UpdateProfileNopaid,
|
||||
@Path() nopaidId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.nopaidRepository.findOneBy({ id: nopaidId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -152,7 +152,7 @@ export class ProfileNopaidController extends Controller {
|
|||
|
||||
@Delete("{nopaidId}")
|
||||
public async deleteNopaid(@Path() nopaidId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.nopaidHistoryRepository.delete({
|
||||
profileNopaidId: nopaidId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export class ProfileOtherController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newOther(@Request() req: RequestWithUser, @Body() body: CreateProfileOther) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ export class ProfileOtherController extends Controller {
|
|||
@Body() body: UpdateProfileOther,
|
||||
@Path() otherId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.otherRepository.findOneBy({ id: otherId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -149,7 +149,7 @@ export class ProfileOtherController extends Controller {
|
|||
|
||||
@Delete("{otherId}")
|
||||
public async deleteOther(@Path() otherId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.otherHistoryRepository.delete({
|
||||
profileOtherId: otherId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ export class ProfileSalaryController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newSalary(@Request() req: RequestWithUser, @Body() body: CreateProfileSalary) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ export class ProfileSalaryController extends Controller {
|
|||
@Body() body: UpdateProfileSalary,
|
||||
@Path() salaryId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.salaryRepo.findOneBy({ id: salaryId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -199,7 +199,7 @@ export class ProfileSalaryController extends Controller {
|
|||
|
||||
@Delete("{salaryId}")
|
||||
public async deleteSalary(@Path() salaryId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.salaryHistoryRepo.delete({
|
||||
profileSalaryId: salaryId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export class ProfileTrainingController extends Controller {
|
|||
|
||||
@Post()
|
||||
public async newTraining(@Request() req: RequestWithUser, @Body() body: CreateProfileTraining) {
|
||||
await new permission().PermissionCreate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_OFFICER");
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ export class ProfileTrainingController extends Controller {
|
|||
@Body() body: UpdateProfileTraining,
|
||||
@Path() trainingId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_OFFICER");
|
||||
const record = await this.trainingRepo.findOneBy({ id: trainingId });
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -192,7 +192,7 @@ export class ProfileTrainingController extends Controller {
|
|||
|
||||
@Delete("{trainingId}")
|
||||
public async deleteTraining(@Path() trainingId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req,"SYS_REGISTRY");
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_OFFICER");
|
||||
await this.trainingHistoryRepo.delete({
|
||||
profileTrainingId: trainingId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import HttpStatus from "./http-status";
|
|||
|
||||
class CheckAuth {
|
||||
public async Permission(req: RequestWithUser, system: string, action: string) {
|
||||
console.log(req);
|
||||
|
||||
await new CallAPI()
|
||||
.GetData(req, "/org/permission")
|
||||
.then((x) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue