fix
This commit is contained in:
parent
8b1543342c
commit
281c5c7dfd
2 changed files with 41 additions and 41 deletions
|
|
@ -2893,7 +2893,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Body() body: UpdateInformationProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
|
||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
|
|
@ -2922,7 +2922,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("information/{profileEmployeeId}")
|
||||
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||
const profileInformation = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -2953,7 +2953,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("information/history/{profileEmployeeId}")
|
||||
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||
const profileInformation = await this.profileRepo.find({
|
||||
relations: {
|
||||
information_histories: true,
|
||||
|
|
@ -2998,7 +2998,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
// await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||
const employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -3023,13 +3023,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
// if (employment) {
|
||||
// await new permission().PermissionOrgUserGet(
|
||||
// req,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );
|
||||
// }//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserGet(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
return new HttpSuccess(employment);
|
||||
}
|
||||
|
||||
|
|
@ -3045,13 +3045,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
// if (employment) {
|
||||
// await new permission().PermissionOrgUserList(
|
||||
// req,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );
|
||||
// }//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserList(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
order: { lastUpdatedAt: "ASC" },
|
||||
|
|
@ -3076,7 +3076,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: profileEmployeeId },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
// await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_EMP", profile.id);//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await new permission().PermissionOrgUserUpdate(request, "SYS_REGISTRY_EMP", profile.id);
|
||||
|
||||
const employment = new ProfileEmployeeEmployment();
|
||||
// const history = new ProfileEmployeeEmploymentHistory();
|
||||
|
|
@ -3111,13 +3111,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
// if (employment) {
|
||||
// await new permission().PermissionOrgUserDelete(
|
||||
// request,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );
|
||||
// }//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
if (employment) {
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
request,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
await this.employmentHistoryRepository.delete({
|
||||
profileEmployeeEmploymentId: id,
|
||||
});
|
||||
|
|
@ -3144,11 +3144,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
) {
|
||||
const employment = await this.employmentRepository.findOneBy({ id });
|
||||
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
// await new permission().PermissionOrgUserUpdate(
|
||||
// request,
|
||||
// "SYS_REGISTRY_EMP",
|
||||
// employment.profileEmployeeId,
|
||||
// );//ไม่แน่ใจEMPปิดไว้ก่อน
|
||||
await new permission().PermissionOrgUserUpdate(
|
||||
request,
|
||||
"SYS_REGISTRY_EMP",
|
||||
employment.profileEmployeeId,
|
||||
);
|
||||
|
||||
const history = new ProfileEmployeeEmploymentHistory();
|
||||
Object.assign(history, { ...employment, id: undefined });
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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().PermissionUpdate(request, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -3090,8 +3090,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Delete("employment/{id}")
|
||||
async DeleteEmployment(@Path() id: string) {
|
||||
// await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMPปิดไว้ก่อน
|
||||
async DeleteEmployment(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_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(request, "SYS_REGISTRY_TEMP");
|
||||
const employment = await this.employmentRepository.findOneBy({ id });
|
||||
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue