แก้api ลูกจ้างประจำ

This commit is contained in:
JoolsoftAdmin 2024-08-13 11:03:42 +07:00
parent ab138c2e04
commit 23e5d4f7fe
44 changed files with 7960 additions and 79 deletions

View file

@ -70,7 +70,7 @@ export class ProfileChildrenEmployeeController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateProfileChildrenEmployee,
) {
await new permission().PermissionCreate(req,"SYS_REGISTRY_EMP");
await new permission().PermissionCreate(req, "SYS_REGISTRY_EMP");
const profile = await this.profileRepository.findOneBy({ id: body.profileEmployeeId });
if (!profile) {
@ -89,7 +89,7 @@ export class ProfileChildrenEmployeeController extends Controller {
Object.assign(data, { ...body, ...meta });
data.childrenCitizenId = Extension.CheckCitizen(String(data.childrenCitizenId));
await this.childrenRepository.save(data);
if(data){
if (data) {
const history: ProfileChildrenHistory = Object.assign(new ProfileChildrenHistory(), {
profileChildrenId: data.id,
childrenCareer: data.childrenCareer,
@ -115,7 +115,7 @@ export class ProfileChildrenEmployeeController extends Controller {
@Body() body: UpdateProfileChildren,
@Path() childrenId: string,
) {
await new permission().PermissionUpdate(req,"SYS_REGISTRY_EMP");
await new permission().PermissionUpdate(req, "SYS_REGISTRY_EMP");
const record = await this.childrenRepository.findOneBy({ id: childrenId });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -129,11 +129,10 @@ export class ProfileChildrenEmployeeController extends Controller {
history.childrenCareer = record.childrenCareer;
history.childrenFirstName = record.childrenFirstName;
history.childrenLastName = record.childrenLastName;
history.childrenPrefix = record.childrenPrefix;
history.childrenPrefix = record.childrenPrefix;
history.childrenLive = record.childrenLive;
history.childrenCitizenId = record.childrenCitizenId;
history.lastUpdateUserId = req.user.sub,
history.lastUpdateFullName = req.user.name;
(history.lastUpdateUserId = req.user.sub), (history.lastUpdateFullName = req.user.name);
await Promise.all([
this.childrenRepository.save(record),
@ -145,7 +144,7 @@ export class ProfileChildrenEmployeeController extends Controller {
@Delete("{childrenId}")
public async deleteTraning(@Path() childrenId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req,"SYS_REGISTRY_EMP");
await new permission().PermissionDelete(req, "SYS_REGISTRY_EMP");
await this.childrenHistoryRepository.delete({
profileChildrenId: childrenId,
});