แก้ออกคำสั่งวินัย

This commit is contained in:
JoolsoftAdmin 2024-08-09 17:31:33 +07:00
parent 5c2bf5fb42
commit 828dd2a37d

View file

@ -1414,10 +1414,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([
this.profileRepo.save(profile),
this.salaryRepository.save(profileSalary),
]);
await Promise.all([this.salaryRepository.save(profileSalary)]);
}
return new HttpSuccess();
}
@ -1451,14 +1448,20 @@ export class ProfileController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
const _profile = await this.profileRepo.findOne({
where: { id: body.profileId },
});
if (!_profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id,"OFFICER");
profile.isLeave = true;
profile.leaveReason =
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason =
"คำสั่งให้ข้าราชการออกจากราชการเพราะผลการทดลองปฏิบัติหน้าที่ราชการต่ำกว่ามาตรฐานที่กำหนด";
profile.dateLeave = dateLeave_;
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -1490,7 +1493,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -1524,13 +1527,19 @@ export class ProfileController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
const _profile = await this.profileRepo.findOne({
where: { id: body.profileId },
});
if (!_profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id,"OFFICER");
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย ปลดออกจากราชการ";
profile.dateLeave = dateLeave_;
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย ปลดออกจากราชการ";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -1562,7 +1571,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -1596,13 +1605,19 @@ export class ProfileController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
const _profile = await this.profileRepo.findOne({
where: { id: body.profileId },
});
if (!_profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id,"OFFICER");
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย ไล่ออกจากราชการ";
profile.dateLeave = dateLeave_;
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย ไล่ออกจากราชการ";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -1645,7 +1660,7 @@ export class ProfileController extends Controller {
// lastUpdateFullName: req.user.name,
// });
await Promise.all([
this.profileRepo.save(profile),
this.profileRepo.save(_profile),
this.salaryRepository.save(profileSalary),
// this.profileDisciplineRepo.save(profileDiscipline)
]);
@ -1682,13 +1697,19 @@ export class ProfileController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
const _profile = await this.profileRepo.findOne({
where: { id: body.profileId },
});
if (!_profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id,"OFFICER");
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย พักจากราชการ";
profile.dateLeave = dateLeave_;
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย พักจากราชการ";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -1720,7 +1741,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -1754,13 +1775,19 @@ export class ProfileController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
const _profile = await this.profileRepo.findOne({
where: { id: body.profileId },
});
if (!_profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id, "OFFICER");
profile.isLeave = true;
profile.leaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการไว้ก่อน";
profile.dateLeave = dateLeave_;
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการไว้ก่อน";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -1792,7 +1819,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -1863,7 +1890,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -1934,7 +1961,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -2005,7 +2032,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -2076,7 +2103,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -2147,7 +2174,7 @@ export class ProfileController extends Controller {
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
await Promise.all([this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
}
@ -2250,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");
const exists =
!!body.citizenId &&
(await this.profileRepo.findOne({