This commit is contained in:
AdisakKanthawilang 2024-08-27 14:19:04 +07:00
parent eb1e797354
commit 79b652d628
9 changed files with 32 additions and 32 deletions

View file

@ -103,7 +103,6 @@ export class ProfileAddressEmployeeTempController extends Controller {
*/
@Get("history/user")
public async getProfileAddressHistoryUser(@Request() request: RequestWithUser) {
// await new permission().PermissionGet(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");

View file

@ -32,7 +32,7 @@ export class ProfileAvatarEmployeeTempController extends Controller {
@Path() id: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMPปิดไว้ก่อน
const result = await this.avatarRepository.findOneBy({ id: id });
if (!result) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");

View file

@ -2285,7 +2285,7 @@ export class ProfileController extends Controller {
) {
const _record = await this.profileRepo.findOneBy({ id: id });
if (_record) {
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", _record.id); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_OFFICER", _record.id);
}
const exists =
!!body.citizenId &&
@ -4838,7 +4838,7 @@ export class ProfileController extends Controller {
*/
@Get("profileid/retire/{year}")
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFF
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน
const profiles = await this.profileRepo
.createQueryBuilder("profile")
.leftJoinAndSelect("profile.posLevel", "posLevel")

View file

@ -141,7 +141,7 @@ export class ProfileDutyController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
const data = new ProfileDuty();

View file

@ -580,7 +580,8 @@ export class ProfileEmployeeController extends Controller {
*
*/
@Post()
async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) { //ไม่แน่ใจEMP
async createProfile(@Body() body: CreateProfileEmployee, @Request() request: RequestWithUser) {
//ไม่แน่ใจEMPปิดไว้ก่อน
if (await this.profileRepo.findOneBy({ citizenId: body.citizenId })) {
throw new HttpError(
HttpStatus.INTERNAL_SERVER_ERROR,
@ -1058,7 +1059,7 @@ export class ProfileEmployeeController extends Controller {
*/
@Get("{id}")
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id); //ไม่แน่ใจEMP
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);
const profile = await this.profileRepo.findOne({
relations: {
posLevel: true,
@ -2659,7 +2660,7 @@ export class ProfileEmployeeController extends Controller {
*/
@Get("profileid/retire/{year}")
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMP
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", id);//ไม่แน่ใจEMPปิดไว้ก่อน
const profiles = await this.profileRepo
.createQueryBuilder("profileEmployee")
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
@ -2862,7 +2863,7 @@ export class ProfileEmployeeController extends Controller {
where: { id: id },
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน
profile.isLeave = requestBody.isLeave;
profile.leaveReason = requestBody.leaveReason;

View file

@ -1056,7 +1056,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("{id}")
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const profile = await this.profileRepo.findOne({
relations: {
posLevel: true,
@ -2075,7 +2075,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() id: string,
@Body() body: UpdatePositionTempProfileEmployee,
) {
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
if (body.posLevelId === "") body.posLevelId = null;
if (body.posTypeId === "") body.posTypeId = null;
@ -2555,7 +2555,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("keycloak/position/{revisionId}")
async getProfileByKeycloakByRevision(
//ไม่แน่ใจTEMP
//ไม่แน่ใจTEMPปิดไว้ก่อน
@Path() revisionId: string,
@Request() request: { user: Record<string, any> },
) {
@ -2657,7 +2657,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("profileid/retire/{year}")
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profiles = await this.profileRepo
.createQueryBuilder("profileEmployee")
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
@ -2856,7 +2856,7 @@ export class ProfileEmployeeTempController extends Controller {
requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date },
@Request() request: { user: Record<string, any> },
) {
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profile = await this.profileRepo.findOne({
where: { id: id },
});
@ -2891,7 +2891,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() profileEmployeeId: string,
@Body() body: UpdateInformationProfileEmployee,
) {
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
@ -2920,7 +2920,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("information/{profileEmployeeId}")
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profileInformation = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
@ -2951,7 +2951,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("information/history/{profileEmployeeId}")
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profileInformation = await this.profileRepo.find({
relations: {
information_histories: true,
@ -2996,7 +2996,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() profileEmployeeId: string,
@Request() req: RequestWithUser,
) {
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const employment = await this.employmentRepository.find({
where: { profileEmployeeId: profileEmployeeId },
order: { createdAt: "ASC" },
@ -3018,7 +3018,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("employment/id/{id}")
async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const employment = await this.employmentRepository.findOne({
where: { id: id },
});
@ -3034,7 +3034,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("employment/history/{id}")
async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const employmentHistory = await this.employmentHistoryRepository.find({
where: { profileEmployeeEmploymentId: id },
order: { lastUpdatedAt: "ASC" },
@ -3055,7 +3055,7 @@ export class ProfileEmployeeTempController extends Controller {
@Body() body: CreateEmploymentProfileEmployee,
@Request() request: RequestWithUser,
) {
// await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profile = await this.profileRepo.findOne({
where: { id: profileEmployeeId },
});
@ -3091,7 +3091,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Delete("employment/{id}")
async DeleteEmployment(@Path() id: string) {
// await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
await this.employmentHistoryRepository.delete({
profileEmployeeEmploymentId: id,
});
@ -3116,7 +3116,7 @@ export class ProfileEmployeeTempController extends Controller {
@Path() id: string,
@Body() body: UpdateEmploymentProfileEmployee,
) {
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const employment = await this.employmentRepository.findOneBy({ id });
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -3146,7 +3146,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Post("report")
async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) {
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } });
const _profiles = await Promise.all(
@ -3185,7 +3185,7 @@ export class ProfileEmployeeTempController extends Controller {
},
@Request() request: { user: Record<string, any> },
) {
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
await Promise.all(
body.result.map(async (v) => {
const profile = await this.profileRepo.findOne({
@ -3245,7 +3245,7 @@ export class ProfileEmployeeTempController extends Controller {
keyword?: string;
},
) {
// await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
let findProfile: any;
let total: any;
const skip = (page - 1) * pageSize;
@ -3404,7 +3404,7 @@ export class ProfileEmployeeTempController extends Controller {
*/
@Get("profileid/position/{id}")
async getProfileByProfileid(@Request() req: RequestWithUser, @Path() id: string) {
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
const profile = await this.profileRepo.findOne({
where: { id: id },
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],

View file

@ -230,7 +230,7 @@ export class ProfileFamilyCoupleController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
familyCouple.createdFullName = req.user.name;

View file

@ -216,7 +216,7 @@ export class ProfileFamilyFatherController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
familyFather.createdUserId = req.user.sub;
familyFather.createdFullName = req.user.name;
@ -239,7 +239,7 @@ export class ProfileFamilyFatherController extends Controller {
@Body() body: UpdateProfileFamilyFather,
@Path() profileId: string,
) {
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId);
const familyFather = await this.ProfileFamilyFather.findOneBy({ profileId: profileId });
if (!familyFather) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");

View file

@ -215,7 +215,7 @@ export class ProfileFamilyMotherController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
familyMother.createdUserId = req.user.sub;
familyMother.createdFullName = req.user.name;
@ -238,7 +238,7 @@ export class ProfileFamilyMotherController extends Controller {
@Body() body: UpdateProfileFamilyMother,
@Path() profileId: string,
) {
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId); //ไม่แน่ใจOFF
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profileId);
const familyMother = await this.ProfileFamilyMother.findOneBy({ profileId: profileId });
if (!familyMother) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");