เพิ่มวันที่แก้ไข
This commit is contained in:
parent
218886b3f4
commit
ad4efc2b47
28 changed files with 205 additions and 40 deletions
|
|
@ -188,7 +188,7 @@ export class AuthRoleController extends Controller {
|
|||
roleName: body.roleName,
|
||||
roleDescription: body.roleDescription,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdatedAt: new Date(),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ export class EmployeePosLevelController extends Controller {
|
|||
EmpPosLevel.createdFullName = request.user.name;
|
||||
EmpPosLevel.lastUpdateUserId = request.user.sub;
|
||||
EmpPosLevel.lastUpdateFullName = request.user.name;
|
||||
EmpPosLevel.createdAt = new Date();
|
||||
EmpPosLevel.lastUpdatedAt = new Date();
|
||||
await this.employeePosLevelRepository.save(EmpPosLevel);
|
||||
return new HttpSuccess(EmpPosLevel.id);
|
||||
}
|
||||
|
|
@ -125,6 +127,7 @@ export class EmployeePosLevelController extends Controller {
|
|||
}
|
||||
EmpPosLevel.lastUpdateUserId = request.user.sub;
|
||||
EmpPosLevel.lastUpdateFullName = request.user.name;
|
||||
EmpPosLevel.lastUpdatedAt = new Date();
|
||||
this.employeePosLevelRepository.merge(EmpPosLevel, requestBody);
|
||||
await this.employeePosLevelRepository.save(EmpPosLevel);
|
||||
return new HttpSuccess(EmpPosLevel.id);
|
||||
|
|
@ -139,11 +142,14 @@ export class EmployeePosLevelController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteType(@Path() id: string) {
|
||||
let result :any
|
||||
let result: any;
|
||||
try {
|
||||
result = await this.employeePosLevelRepository.delete({ id: id });
|
||||
} catch {
|
||||
throw new HttpError( HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้เนื่องจากมีการใช้งานระดับชั้นงานนี้อยู่");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่สามารถลบได้เนื่องจากมีการใช้งานระดับชั้นงานนี้อยู่",
|
||||
);
|
||||
}
|
||||
if (result.affected == undefined || result.affected <= 0) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ export class EmployeePosTypeController extends Controller {
|
|||
EmpPosType.createdFullName = request.user.name;
|
||||
EmpPosType.lastUpdateUserId = request.user.sub;
|
||||
EmpPosType.lastUpdateFullName = request.user.name;
|
||||
EmpPosType.createdAt = new Date();
|
||||
EmpPosType.lastUpdatedAt = new Date();
|
||||
await this.employeePosTypeRepository.save(EmpPosType);
|
||||
return new HttpSuccess(EmpPosType.id);
|
||||
}
|
||||
|
|
@ -120,6 +122,7 @@ export class EmployeePosTypeController extends Controller {
|
|||
}
|
||||
EmpPosType.lastUpdateUserId = request.user.sub;
|
||||
EmpPosType.lastUpdateFullName = request.user.name;
|
||||
EmpPosType.lastUpdatedAt = new Date();
|
||||
this.employeePosTypeRepository.merge(EmpPosType, requestBody);
|
||||
await this.employeePosTypeRepository.save(EmpPosType);
|
||||
return new HttpSuccess(EmpPosType.id);
|
||||
|
|
@ -134,11 +137,14 @@ export class EmployeePosTypeController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteType(@Path() id: string) {
|
||||
let result :any
|
||||
let result: any;
|
||||
try {
|
||||
result = await this.employeePosTypeRepository.delete({ id: id });
|
||||
} catch {
|
||||
throw new HttpError( HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้เนื่องจากมีการใช้งานระดับกลุ่มงานนี้อยู่");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่สามารถลบได้เนื่องจากมีการใช้งานระดับกลุ่มงานนี้อยู่",
|
||||
);
|
||||
}
|
||||
if (result.affected == undefined || result.affected <= 0) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ export class GenderController extends Controller {
|
|||
_gender.createdFullName = request.user.name;
|
||||
_gender.lastUpdateUserId = request.user.sub;
|
||||
_gender.lastUpdateFullName = request.user.name;
|
||||
_gender.createdAt = new Date();
|
||||
_gender.lastUpdatedAt = new Date();
|
||||
await this.genderRepository.save(_gender);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -129,6 +131,7 @@ export class GenderController extends Controller {
|
|||
|
||||
_gender.lastUpdateUserId = request.user.sub;
|
||||
_gender.lastUpdateFullName = request.user.name;
|
||||
_gender.lastUpdatedAt = new Date();
|
||||
this.genderRepository.merge(_gender, requestBody);
|
||||
await this.genderRepository.save(_gender);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ export class ImportDataController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
profiles.push(profile);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
|
||||
|
|
@ -248,6 +250,8 @@ export class ImportDataController extends Controller {
|
|||
profileEmp.createdFullName = request.user.name;
|
||||
profileEmp.lastUpdateUserId = request.user.sub;
|
||||
profileEmp.lastUpdateFullName = request.user.name;
|
||||
profileEmp.createdAt = new Date();
|
||||
profileEmp.lastUpdatedAt = new Date();
|
||||
profiles.push(profileEmp);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
|
||||
|
|
@ -336,6 +340,8 @@ export class ImportDataController extends Controller {
|
|||
profileSalary.createdFullName = request.user.name;
|
||||
profileSalary.lastUpdateUserId = request.user.sub;
|
||||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
profileSalary.createdAt = new Date();
|
||||
profileSalary.lastUpdatedAt = new Date();
|
||||
// profileSalarys.push(profileSalary);
|
||||
// await this.salaryRepository.save(profileSalary);
|
||||
// if (profileSalarys.length === BATCH_SIZE) {
|
||||
|
|
@ -428,6 +434,8 @@ export class ImportDataController extends Controller {
|
|||
profileSalary.createdFullName = request.user.name;
|
||||
profileSalary.lastUpdateUserId = request.user.sub;
|
||||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
profileSalary.createdAt = new Date();
|
||||
profileSalary.lastUpdatedAt = new Date();
|
||||
// profileSalarys.push(profileSalary);
|
||||
// await this.salaryRepository.save(profileSalary);
|
||||
// if (profileSalarys.length === BATCH_SIZE) {
|
||||
|
|
@ -509,6 +517,8 @@ export class ImportDataController extends Controller {
|
|||
profileFather.createdFullName = request.user.name;
|
||||
profileFather.lastUpdateUserId = request.user.sub;
|
||||
profileFather.lastUpdateFullName = request.user.name;
|
||||
profileFather.createdAt = new Date();
|
||||
profileFather.lastUpdatedAt = new Date();
|
||||
|
||||
profileMother.profileId = _item.id;
|
||||
profileMother.motherPrefix = existingProfile.MOTHER_RANK_NAME;
|
||||
|
|
@ -518,6 +528,8 @@ export class ImportDataController extends Controller {
|
|||
profileMother.createdFullName = request.user.name;
|
||||
profileMother.lastUpdateUserId = request.user.sub;
|
||||
profileMother.lastUpdateFullName = request.user.name;
|
||||
profileMother.createdAt = new Date();
|
||||
profileMother.lastUpdatedAt = new Date();
|
||||
|
||||
profileCouple.profileId = _item.id;
|
||||
profileCouple.couplePrefix = existingProfile.SPOUSE_RANK_NAME;
|
||||
|
|
@ -539,6 +551,8 @@ export class ImportDataController extends Controller {
|
|||
profileCouple.createdFullName = request.user.name;
|
||||
profileCouple.lastUpdateUserId = request.user.sub;
|
||||
profileCouple.lastUpdateFullName = request.user.name;
|
||||
profileCouple.createdAt = new Date();
|
||||
profileCouple.lastUpdatedAt = new Date();
|
||||
|
||||
// fathers.push(profileFather);
|
||||
// mothers.push(profileMother);
|
||||
|
|
@ -633,6 +647,8 @@ export class ImportDataController extends Controller {
|
|||
profileFather.createdFullName = request.user.name;
|
||||
profileFather.lastUpdateUserId = request.user.sub;
|
||||
profileFather.lastUpdateFullName = request.user.name;
|
||||
profileFather.createdAt = new Date();
|
||||
profileFather.lastUpdatedAt = new Date();
|
||||
|
||||
profileMother.profileEmployeeId = _item.id;
|
||||
profileMother.motherPrefix = existingProfile.MOTHER_RANK_NAME;
|
||||
|
|
@ -642,6 +658,8 @@ export class ImportDataController extends Controller {
|
|||
profileMother.createdFullName = request.user.name;
|
||||
profileMother.lastUpdateUserId = request.user.sub;
|
||||
profileMother.lastUpdateFullName = request.user.name;
|
||||
profileMother.createdAt = new Date();
|
||||
profileMother.lastUpdatedAt = new Date();
|
||||
|
||||
profileCouple.profileEmployeeId = _item.id;
|
||||
profileCouple.couplePrefix = existingProfile.SPOUSE_RANK_NAME;
|
||||
|
|
@ -663,6 +681,8 @@ export class ImportDataController extends Controller {
|
|||
profileCouple.createdFullName = request.user.name;
|
||||
profileCouple.lastUpdateUserId = request.user.sub;
|
||||
profileCouple.lastUpdateFullName = request.user.name;
|
||||
profileCouple.createdAt = new Date();
|
||||
profileCouple.lastUpdatedAt = new Date();
|
||||
|
||||
// fathers.push(profileFather);
|
||||
// mothers.push(profileMother);
|
||||
|
|
@ -720,6 +740,8 @@ export class ImportDataController extends Controller {
|
|||
educationMis.createdFullName = request.user.name;
|
||||
educationMis.lastUpdateUserId = request.user.sub;
|
||||
educationMis.lastUpdateFullName = request.user.name;
|
||||
educationMis.createdAt = new Date();
|
||||
educationMis.lastUpdatedAt = new Date();
|
||||
educationMis_.push(educationMis);
|
||||
}),
|
||||
);
|
||||
|
|
@ -786,6 +808,8 @@ export class ImportDataController extends Controller {
|
|||
education.createdFullName = request.user.name;
|
||||
education.lastUpdateUserId = request.user.sub;
|
||||
education.lastUpdateFullName = request.user.name;
|
||||
education.createdAt = new Date();
|
||||
education.lastUpdatedAt = new Date();
|
||||
// await educations.push(await education);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.educationRepository.save(await education);
|
||||
|
|
@ -860,6 +884,8 @@ export class ImportDataController extends Controller {
|
|||
education.createdFullName = request.user.name;
|
||||
education.lastUpdateUserId = request.user.sub;
|
||||
education.lastUpdateFullName = request.user.name;
|
||||
education.createdAt = new Date();
|
||||
education.lastUpdatedAt = new Date();
|
||||
// educations.push(education);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.educationRepository.save(education);
|
||||
|
|
@ -898,6 +924,8 @@ export class ImportDataController extends Controller {
|
|||
prov.createdFullName = request.user.name;
|
||||
prov.lastUpdateUserId = request.user.sub;
|
||||
prov.lastUpdateFullName = request.user.name;
|
||||
prov.createdAt = new Date();
|
||||
prov.lastUpdatedAt = new Date();
|
||||
provinces_.push(prov);
|
||||
}),
|
||||
);
|
||||
|
|
@ -930,6 +958,8 @@ export class ImportDataController extends Controller {
|
|||
amh.createdFullName = request.user.name;
|
||||
amh.lastUpdateUserId = request.user.sub;
|
||||
amh.lastUpdateFullName = request.user.name;
|
||||
amh.createdAt = new Date();
|
||||
amh.lastUpdatedAt = new Date();
|
||||
amphur_.push(amh);
|
||||
}),
|
||||
);
|
||||
|
|
@ -963,6 +993,8 @@ export class ImportDataController extends Controller {
|
|||
subD.createdFullName = request.user.name;
|
||||
subD.lastUpdateUserId = request.user.sub;
|
||||
subD.lastUpdateFullName = request.user.name;
|
||||
subD.createdAt = new Date();
|
||||
subD.lastUpdatedAt = new Date();
|
||||
subDistrict_.push(subD);
|
||||
}),
|
||||
);
|
||||
|
|
@ -1112,6 +1144,8 @@ export class ImportDataController extends Controller {
|
|||
_item.createdFullName = request.user.name;
|
||||
_item.lastUpdateUserId = request.user.sub;
|
||||
_item.lastUpdateFullName = request.user.name;
|
||||
_item.createdAt = new Date();
|
||||
_item.lastUpdatedAt = new Date();
|
||||
// profileDatas.push(_item);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.profileRepo.save(_item);
|
||||
|
|
@ -1265,6 +1299,8 @@ export class ImportDataController extends Controller {
|
|||
_item.createdFullName = request.user.name;
|
||||
_item.lastUpdateUserId = request.user.sub;
|
||||
_item.lastUpdateFullName = request.user.name;
|
||||
_item.createdAt = new Date();
|
||||
_item.lastUpdatedAt = new Date();
|
||||
// profileDatas.push(_item);
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.profileEmpRepo.save(_item);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ export class InsigniaController extends Controller {
|
|||
insignia.createdFullName = request.user.name;
|
||||
insignia.lastUpdateUserId = request.user.sub;
|
||||
insignia.lastUpdateFullName = request.user.name;
|
||||
insignia.createdAt = new Date();
|
||||
insignia.lastUpdatedAt = new Date();
|
||||
await this.insigniaRepository.save(insignia);
|
||||
return new HttpSuccess(insignia.id);
|
||||
}
|
||||
|
|
@ -113,6 +115,7 @@ export class InsigniaController extends Controller {
|
|||
|
||||
insignia.lastUpdateUserId = request.user.sub;
|
||||
insignia.lastUpdateFullName = request.user.name;
|
||||
insignia.lastUpdatedAt = new Date();
|
||||
this.insigniaRepository.merge(insignia, requestBody);
|
||||
await this.insigniaRepository.save(insignia);
|
||||
return new HttpSuccess(insignia.id);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import HttpSuccess from "../interfaces/http-success";
|
|||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { Equal, ILike, In, IsNull, Like, Not, Brackets, Between } from "typeorm";
|
||||
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
|
||||
import { Insignia, } from "../entities/Insignia";
|
||||
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
|
||||
import { Insignia } from "../entities/Insignia";
|
||||
|
||||
@Route("api/v1/org/insignia/insignia-type")
|
||||
@Tags("InsigniaType")
|
||||
|
|
@ -33,10 +33,9 @@ import { Insignia, } from "../entities/Insignia";
|
|||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class InsigniaTypeController extends Controller {
|
||||
|
||||
private insigniaTypeRepository = AppDataSource.getRepository(InsigniaType);
|
||||
private insigniaRepository = AppDataSource.getRepository(Insignia);
|
||||
|
||||
|
||||
/**
|
||||
* API เพิ่มข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
*
|
||||
|
|
@ -48,7 +47,6 @@ export class InsigniaTypeController extends Controller {
|
|||
@Body() requestBody: CreateInsigniaType,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
|
||||
const insigniaType = Object.assign(new InsigniaType(), requestBody);
|
||||
if (!insigniaType) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -68,6 +66,8 @@ export class InsigniaTypeController extends Controller {
|
|||
insigniaType.createdFullName = request.user.name;
|
||||
insigniaType.lastUpdateUserId = request.user.sub;
|
||||
insigniaType.lastUpdateFullName = request.user.name;
|
||||
insigniaType.createdAt = new Date();
|
||||
insigniaType.lastUpdatedAt = new Date();
|
||||
await this.insigniaTypeRepository.save(insigniaType);
|
||||
return new HttpSuccess(insigniaType.id);
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ export class InsigniaTypeController extends Controller {
|
|||
*
|
||||
* @summary แก้ไขลำดับชั้นเครื่องราชอิสริยาภรณ์ (ADMIN)
|
||||
*
|
||||
* @param {string} id Id ลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
* @param {string} id Id ลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
*/
|
||||
@Put("{id}")
|
||||
async UpdateInsigniaType(
|
||||
|
|
@ -104,6 +104,7 @@ export class InsigniaTypeController extends Controller {
|
|||
|
||||
insigniaType.lastUpdateUserId = request.user.sub;
|
||||
insigniaType.lastUpdateFullName = request.user.name;
|
||||
insigniaType.lastUpdatedAt = new Date();
|
||||
this.insigniaTypeRepository.merge(insigniaType, requestBody);
|
||||
await this.insigniaTypeRepository.save(insigniaType);
|
||||
return new HttpSuccess(insigniaType.id);
|
||||
|
|
@ -122,11 +123,14 @@ export class InsigniaTypeController extends Controller {
|
|||
if (!delInsigniaType) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์นี้");
|
||||
}
|
||||
const Insignia = await this.insigniaRepository.find({
|
||||
where: { insigniaTypeId: id }
|
||||
const Insignia = await this.insigniaRepository.find({
|
||||
where: { insigniaTypeId: id },
|
||||
});
|
||||
if (Insignia.length > 0) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้ เนื่องจากพบข้อมูลที่ตารางเครื่องราชอิสริยาภรณ์");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่สามารถลบได้ เนื่องจากพบข้อมูลที่ตารางเครื่องราชอิสริยาภรณ์",
|
||||
);
|
||||
}
|
||||
await this.insigniaTypeRepository.remove(delInsigniaType);
|
||||
return new HttpSuccess();
|
||||
|
|
@ -143,7 +147,7 @@ export class InsigniaTypeController extends Controller {
|
|||
const insigniaType_Active = await this.insigniaTypeRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
where: { isActive: true },
|
||||
order: { "name": "ASC" }
|
||||
order: { name: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(insigniaType_Active);
|
||||
}
|
||||
|
|
@ -153,7 +157,7 @@ export class InsigniaTypeController extends Controller {
|
|||
*
|
||||
* @summary ORG_037 - รายละเอียดข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์ (ADMIN) #
|
||||
*
|
||||
* @param {string} id Id ลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
* @param {string} id Id ลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetInsigniaTypeById(@Path() id: string) {
|
||||
|
|
@ -163,7 +167,10 @@ export class InsigniaTypeController extends Controller {
|
|||
where: { id: id },
|
||||
});
|
||||
if (!insigniaType) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์ นี้");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่พบข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์ นี้",
|
||||
);
|
||||
}
|
||||
return new HttpSuccess(insigniaType);
|
||||
}
|
||||
|
|
@ -178,7 +185,7 @@ export class InsigniaTypeController extends Controller {
|
|||
async GetInsigniaType() {
|
||||
const insigniaTypeAll = await this.insigniaTypeRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
order: { "name": "ASC" }
|
||||
order: { name: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(insigniaTypeAll);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ export class OrgChild1Controller {
|
|||
child1.createdFullName = request.user.name;
|
||||
child1.lastUpdateUserId = request.user.sub;
|
||||
child1.lastUpdateFullName = request.user.name;
|
||||
child1.createdAt = new Date();
|
||||
child1.lastUpdatedAt = new Date();
|
||||
child1.orgRevisionId = String(rootIdExits?.orgRevisionId);
|
||||
child1.orgRootId = String(rootIdExits?.id);
|
||||
child1.orgChild1Order =
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ export class OrgChild2Controller extends Controller {
|
|||
child2.createdFullName = request.user.name;
|
||||
child2.lastUpdateUserId = request.user.sub;
|
||||
child2.lastUpdateFullName = request.user.name;
|
||||
child2.createdAt = new Date();
|
||||
child2.lastUpdatedAt = new Date();
|
||||
child2.orgRootId = String(child1?.orgRootId);
|
||||
child2.orgRevisionId = String(child1?.orgRevisionId);
|
||||
child2.orgChild1Id = String(child1?.id);
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ export class OrgChild3Controller {
|
|||
child3.createdFullName = request.user.name;
|
||||
child3.lastUpdateUserId = request.user.sub;
|
||||
child3.lastUpdateFullName = request.user.name;
|
||||
child3.createdAt = new Date();
|
||||
child3.lastUpdatedAt = new Date();
|
||||
child3.orgRootId = String(child2?.orgRootId);
|
||||
child3.orgChild1Id = String(child2?.orgChild1Id);
|
||||
child3.orgRevisionId = String(child2?.orgRevisionId);
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ export class OrgChild4Controller extends Controller {
|
|||
child4.createdFullName = request.user.name;
|
||||
child4.lastUpdateUserId = request.user.sub;
|
||||
child4.lastUpdateFullName = request.user.name;
|
||||
child4.createdAt = new Date();
|
||||
child4.lastUpdatedAt = new Date();
|
||||
child4.orgRootId = String(child3?.orgRootId);
|
||||
child4.orgChild1Id = String(child3?.orgChild1Id);
|
||||
child4.orgChild2Id = String(child3?.orgChild2Id);
|
||||
|
|
@ -189,7 +191,7 @@ export class OrgChild4Controller extends Controller {
|
|||
requestBody: UpdateOrgChild4,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
const child3IdExits = await this.child3Repository.findOne({
|
||||
where: { id: requestBody.orgChild3Id },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ export class OrgRootController extends Controller {
|
|||
orgRoot.createdFullName = request.user.name;
|
||||
orgRoot.lastUpdateUserId = request.user.sub;
|
||||
orgRoot.lastUpdateFullName = request.user.name;
|
||||
orgRoot.createdAt = new Date();
|
||||
orgRoot.lastUpdatedAt = new Date();
|
||||
orgRoot.orgRootOrder = order == null || order.orgRootOrder == null ? 1 : order.orgRootOrder + 1;
|
||||
await this.orgRootRepository.save(orgRoot);
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ export class OrganizationController extends Controller {
|
|||
revision.createdFullName = request.user.name;
|
||||
revision.lastUpdateUserId = request.user.sub;
|
||||
revision.lastUpdateFullName = request.user.name;
|
||||
revision.createdAt = new Date();
|
||||
revision.lastUpdatedAt = new Date();
|
||||
await this.orgRevisionRepository.save(revision);
|
||||
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -828,6 +828,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
profile.dutyTimeEffectiveDate = body.effectiveDate;
|
||||
profile.lastUpdateUserId = req.user.sub;
|
||||
profile.lastUpdateFullName = req.user.name;
|
||||
profile.lastUpdatedAt = new Date();
|
||||
await this.profileRepo.save(profile);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ export class PosExecutiveController extends Controller {
|
|||
posExecutive.createdFullName = request.user.name;
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.createdAt = new Date();
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
return new HttpSuccess(posExecutive.id);
|
||||
}
|
||||
|
|
@ -138,6 +140,7 @@ export class PosExecutiveController extends Controller {
|
|||
posExecutive.posExecutiveName = requestBody.posExecutiveName;
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
// this.posExecutiveRepository.merge(posExecutive, requestBody);
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ export class PosLevelController extends Controller {
|
|||
posLevel.createdFullName = request.user.name;
|
||||
posLevel.lastUpdateUserId = request.user.sub;
|
||||
posLevel.lastUpdateFullName = request.user.name;
|
||||
posLevel.createdAt = new Date();
|
||||
posLevel.lastUpdatedAt = new Date();
|
||||
await this.posLevelRepository.save(posLevel);
|
||||
return new HttpSuccess(posLevel);
|
||||
}
|
||||
|
|
@ -144,6 +146,7 @@ export class PosLevelController extends Controller {
|
|||
|
||||
posLevel.lastUpdateUserId = request.user.sub;
|
||||
posLevel.lastUpdateFullName = request.user.name;
|
||||
posLevel.lastUpdatedAt = new Date();
|
||||
this.posLevelRepository.merge(posLevel, requestBody);
|
||||
await this.posLevelRepository.save(posLevel);
|
||||
return new HttpSuccess(posLevel.id);
|
||||
|
|
@ -158,11 +161,14 @@ export class PosLevelController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteLevel(@Path() id: string) {
|
||||
let result :any
|
||||
let result: any;
|
||||
try {
|
||||
result = await this.posLevelRepository.delete({ id: id });
|
||||
} catch {
|
||||
throw new HttpError( HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้เนื่องจากมีการใช้งานระดับตำแหน่งนี้อยู่");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่สามารถลบได้เนื่องจากมีการใช้งานระดับตำแหน่งนี้อยู่",
|
||||
);
|
||||
}
|
||||
if (result.affected == undefined || result.affected <= 0) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ export class PosMasterActController extends Controller {
|
|||
posMasterAct.createdFullName = request.user.name;
|
||||
posMasterAct.lastUpdateUserId = request.user.sub;
|
||||
posMasterAct.lastUpdateFullName = request.user.name;
|
||||
posMasterAct.createdAt = new Date();
|
||||
posMasterAct.lastUpdatedAt = new Date();
|
||||
await this.posMasterActRepository.save(posMasterAct);
|
||||
return new HttpSuccess(posMasterAct);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ export class PosTypeController extends Controller {
|
|||
posType.createdFullName = request.user.name;
|
||||
posType.lastUpdateUserId = request.user.sub;
|
||||
posType.lastUpdateFullName = request.user.name;
|
||||
posType.createdAt = new Date();
|
||||
posType.lastUpdatedAt = new Date();
|
||||
await this.posTypeRepository.save(posType);
|
||||
return new HttpSuccess(posType);
|
||||
}
|
||||
|
|
@ -104,6 +106,7 @@ export class PosTypeController extends Controller {
|
|||
}
|
||||
posType.lastUpdateUserId = request.user.sub;
|
||||
posType.lastUpdateFullName = request.user.name;
|
||||
posType.lastUpdatedAt = new Date();
|
||||
this.posTypeRepository.merge(posType, requestBody);
|
||||
await this.posTypeRepository.save(posType);
|
||||
return new HttpSuccess(posType.id);
|
||||
|
|
@ -118,11 +121,14 @@ export class PosTypeController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteType(@Path() id: string) {
|
||||
let result :any
|
||||
let result: any;
|
||||
try {
|
||||
result = await this.posTypeRepository.delete({ id: id });
|
||||
} catch {
|
||||
throw new HttpError( HttpStatusCode.NOT_FOUND, "ไม่สามารถลบได้เนื่องจากมีการใช้งานประเภทตำแหน่งนี้อยู่");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่สามารถลบได้เนื่องจากมีการใช้งานประเภทตำแหน่งนี้อยู่",
|
||||
);
|
||||
}
|
||||
if (result.affected == undefined || result.affected <= 0) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
|
|||
|
|
@ -143,6 +143,8 @@ export class PositionController extends Controller {
|
|||
posDict.createdFullName = request.user.name;
|
||||
posDict.lastUpdateUserId = request.user.sub;
|
||||
posDict.lastUpdateFullName = request.user.name;
|
||||
posDict.createdAt = new Date();
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
await this.posDictRepository.save(posDict);
|
||||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
|
@ -222,6 +224,8 @@ export class PositionController extends Controller {
|
|||
posExecutive.createdFullName = request.user.name;
|
||||
posExecutive.lastUpdateUserId = request.user.sub;
|
||||
posExecutive.lastUpdateFullName = request.user.name;
|
||||
posExecutive.createdAt = new Date();
|
||||
posExecutive.lastUpdatedAt = new Date();
|
||||
await this.posExecutiveRepository.save(posExecutive);
|
||||
}
|
||||
|
||||
|
|
@ -246,6 +250,8 @@ export class PositionController extends Controller {
|
|||
posDict.createdFullName = request.user.name;
|
||||
posDict.lastUpdateUserId = request.user.sub;
|
||||
posDict.lastUpdateFullName = request.user.name;
|
||||
posDict.createdAt = new Date();
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
await this.posDictRepository.save(posDict);
|
||||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
|
@ -331,18 +337,19 @@ export class PositionController extends Controller {
|
|||
Object.assign(posDict, requestBody);
|
||||
posDict.lastUpdateUserId = request.user.sub;
|
||||
posDict.lastUpdateFullName = request.user.name;
|
||||
(posDict.posDictName = requestBody.posDictName),
|
||||
(posDict.posDictField = requestBody.posDictField),
|
||||
(posDict.posTypeId = requestBody.posTypeId),
|
||||
(posDict.posLevelId = requestBody.posLevelId),
|
||||
(posDict.posExecutiveId = requestBody.posExecutiveId ? requestBody.posExecutiveId : null),
|
||||
(posDict.posDictExecutiveField = requestBody.posDictExecutiveField
|
||||
? requestBody.posDictExecutiveField
|
||||
: ""),
|
||||
(posDict.posDictArea = requestBody.posDictArea ? requestBody.posDictArea : ""),
|
||||
(posDict.isSpecial = requestBody.isSpecial),
|
||||
// this.posDictRepository.merge(posDict, requestBody);
|
||||
await this.posDictRepository.save(posDict);
|
||||
posDict.lastUpdatedAt = new Date();
|
||||
posDict.posDictName = requestBody.posDictName;
|
||||
posDict.posDictField = requestBody.posDictField;
|
||||
posDict.posTypeId = requestBody.posTypeId;
|
||||
posDict.posLevelId = requestBody.posLevelId;
|
||||
posDict.posExecutiveId = requestBody.posExecutiveId ? requestBody.posExecutiveId : null;
|
||||
posDict.posDictExecutiveField = requestBody.posDictExecutiveField
|
||||
? requestBody.posDictExecutiveField
|
||||
: "";
|
||||
posDict.posDictArea = requestBody.posDictArea ? requestBody.posDictArea : "";
|
||||
posDict.isSpecial = requestBody.isSpecial;
|
||||
// this.posDictRepository.merge(posDict, requestBody);
|
||||
await this.posDictRepository.save(posDict);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -743,6 +750,8 @@ export class PositionController extends Controller {
|
|||
posMaster.createdFullName = request.user.name;
|
||||
posMaster.lastUpdateUserId = request.user.sub;
|
||||
posMaster.lastUpdateFullName = request.user.name;
|
||||
posMaster.createdAt = new Date();
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
await Promise.all(
|
||||
requestBody.positions.map(async (x: any) => {
|
||||
|
|
@ -761,6 +770,8 @@ export class PositionController extends Controller {
|
|||
position.createdFullName = request.user.name;
|
||||
position.lastUpdateUserId = request.user.sub;
|
||||
position.lastUpdateFullName = request.user.name;
|
||||
position.createdAt = new Date();
|
||||
position.lastUpdatedAt = new Date();
|
||||
await this.positionRepository.save(position);
|
||||
}),
|
||||
);
|
||||
|
|
@ -948,6 +959,8 @@ export class PositionController extends Controller {
|
|||
posMaster.createdFullName = request.user.name;
|
||||
posMaster.lastUpdateUserId = request.user.sub;
|
||||
posMaster.lastUpdateFullName = request.user.name;
|
||||
posMaster.createdAt = new Date();
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
await this.positionRepository.delete({ posMasterId: posMaster.id });
|
||||
|
||||
|
|
@ -970,6 +983,8 @@ export class PositionController extends Controller {
|
|||
position.createdFullName = request.user.name;
|
||||
position.lastUpdateUserId = request.user.sub;
|
||||
position.lastUpdateFullName = request.user.name;
|
||||
position.createdAt = new Date();
|
||||
position.lastUpdatedAt = new Date();
|
||||
await this.positionRepository.save(position);
|
||||
}),
|
||||
);
|
||||
|
|
@ -1407,7 +1422,10 @@ export class PositionController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Post("sort")
|
||||
async Sort(@Body() requestBody: { id: string; type: number; sortId: string[] }, @Request() request: RequestWithUser) {
|
||||
async Sort(
|
||||
@Body() requestBody: { id: string; type: number; sortId: string[] },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
switch (requestBody.type) {
|
||||
case 0: {
|
||||
|
|
@ -2014,6 +2032,8 @@ export class PositionController extends Controller {
|
|||
posMaster.createdFullName = request.user.name;
|
||||
posMaster.lastUpdateUserId = request.user.sub;
|
||||
posMaster.lastUpdateFullName = request.user.name;
|
||||
posMaster.createdAt = new Date();
|
||||
posMaster.lastUpdatedAt = new Date();
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
}
|
||||
}),
|
||||
|
|
@ -2476,7 +2496,7 @@ export class PositionController extends Controller {
|
|||
@Post("profile")
|
||||
async createHolder(
|
||||
@Body() requestBody: { posMaster: string; position: string; profileId: string; isSit: boolean },
|
||||
@Request() request: RequestWithUser
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
const dataMaster = await this.posMasterRepository.findOne({
|
||||
|
|
@ -2511,7 +2531,7 @@ export class PositionController extends Controller {
|
|||
*/
|
||||
@Post("profile/delete/{id}")
|
||||
async deleteHolder(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_ORG");
|
||||
await new permission().PermissionDelete(request, "SYS_ORG");
|
||||
const dataMaster = await this.posMasterRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["positions"],
|
||||
|
|
@ -2540,8 +2560,11 @@ export class PositionController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Post("dna")
|
||||
async dna(@Body() requestBody: { draftPositionId: string; publishPositionId: string }, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
async dna(
|
||||
@Body() requestBody: { draftPositionId: string; publishPositionId: string },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
const findDraft = await this.orgRevisionRepository.findOne({
|
||||
where: {
|
||||
orgRevisionIsDraft: true,
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ export class PrefixController extends Controller {
|
|||
_prefix.createdFullName = request.user.name;
|
||||
_prefix.lastUpdateUserId = request.user.sub;
|
||||
_prefix.lastUpdateFullName = request.user.name;
|
||||
_prefix.createdAt = new Date();
|
||||
_prefix.lastUpdatedAt = new Date();
|
||||
await this.prefixRepository.save(_prefix);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -128,6 +130,7 @@ export class PrefixController extends Controller {
|
|||
|
||||
_prefix.lastUpdateUserId = request.user.sub;
|
||||
_prefix.lastUpdateFullName = request.user.name;
|
||||
_prefix.lastUpdatedAt = new Date();
|
||||
this.prefixRepository.merge(_prefix, requestBody);
|
||||
await this.prefixRepository.save(_prefix);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -1268,6 +1268,8 @@ export class ProfileController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
profile.dateRetire = calculateRetireDate(profile.birthDate);
|
||||
profile.dateRetireLaw = calculateRetireLaw(profile.birthDate);
|
||||
await this.profileRepo.save(profile);
|
||||
|
|
@ -1310,6 +1312,8 @@ export class ProfileController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
await this.profileRepo.save(profile);
|
||||
return new HttpSuccess(profile.id);
|
||||
}
|
||||
|
|
@ -1346,6 +1350,8 @@ export class ProfileController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
await this.profileRepo.save(profile);
|
||||
return new HttpSuccess(profile.id);
|
||||
}
|
||||
|
|
@ -1386,6 +1392,7 @@ export class ProfileController extends Controller {
|
|||
profile.isProbation = false;
|
||||
profile.lastUpdateUserId = req.user.sub;
|
||||
profile.lastUpdateFullName = req.user.name;
|
||||
profile.lastUpdatedAt = new Date();
|
||||
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||
profileId: body.profileId,
|
||||
date: body.date,
|
||||
|
|
@ -1470,6 +1477,7 @@ export class ProfileController extends Controller {
|
|||
_profile.dateLeave = dateLeave_;
|
||||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||
profileId: body.profileId,
|
||||
date: body.date,
|
||||
|
|
@ -1550,6 +1558,7 @@ export class ProfileController extends Controller {
|
|||
_profile.dateLeave = dateLeave_;
|
||||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||
profileId: body.profileId,
|
||||
date: body.date,
|
||||
|
|
@ -1630,6 +1639,7 @@ export class ProfileController extends Controller {
|
|||
_profile.dateLeave = dateLeave_;
|
||||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||
profileId: body.profileId,
|
||||
date: body.date,
|
||||
|
|
@ -1726,6 +1736,7 @@ export class ProfileController extends Controller {
|
|||
_profile.dateLeave = dateLeave_;
|
||||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||
profileId: body.profileId,
|
||||
date: body.date,
|
||||
|
|
@ -2245,6 +2256,7 @@ export class ProfileController extends Controller {
|
|||
profile.dateLeave = null_;
|
||||
profile.lastUpdateUserId = req.user.sub;
|
||||
profile.lastUpdateFullName = req.user.name;
|
||||
profile.lastUpdatedAt = new Date();
|
||||
// const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||
// profileId: body.profileId,
|
||||
// date: body.date,
|
||||
|
|
@ -2387,6 +2399,7 @@ export class ProfileController extends Controller {
|
|||
Object.assign(record, body);
|
||||
record.lastUpdateUserId = request.user.sub;
|
||||
record.lastUpdateFullName = request.user.name;
|
||||
record.lastUpdatedAt = new Date();
|
||||
record.dateRetire = calculateRetireDate(record.birthDate);
|
||||
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
||||
await this.profileRepo.save(record);
|
||||
|
|
@ -5487,6 +5500,8 @@ export class ProfileController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
// return new HttpSuccess(profile);
|
||||
await this.profileRepo.save(profile);
|
||||
return new HttpSuccess(profile.id);
|
||||
|
|
|
|||
|
|
@ -612,6 +612,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
profile.dateRetire = calculateRetireDate(profile.birthDate);
|
||||
profile.dateRetireLaw = calculateRetireLaw(profile.birthDate);
|
||||
profile.citizenId = Extension.CheckCitizen(profile.citizenId);
|
||||
|
|
@ -684,6 +686,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
Object.assign(record, body);
|
||||
record.lastUpdateUserId = request.user.sub;
|
||||
record.lastUpdateFullName = request.user.name;
|
||||
record.lastUpdatedAt = new Date();
|
||||
record.dateRetire = calculateRetireDate(record.birthDate);
|
||||
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
||||
record.citizenId = Extension.CheckCitizen(record.citizenId);
|
||||
|
|
@ -2208,6 +2211,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
profileEmp.lastUpdateUserId = request.user.sub;
|
||||
profileEmp.lastUpdateFullName = request.user.name;
|
||||
profileEmp.lastUpdatedAt = new Date();
|
||||
profileEmp.nodeTemp = String(body.node);
|
||||
profileEmp.nodeIdTemp = body.nodeId;
|
||||
profileEmp.orgRevisionIdTemp = body.orgRevisionId;
|
||||
|
|
@ -2937,6 +2941,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
profileEmp.lastUpdateUserId = request.user.sub;
|
||||
profileEmp.lastUpdateFullName = request.user.name;
|
||||
profileEmp.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileRepo.save(profileEmp),
|
||||
|
|
@ -3190,11 +3195,14 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
employment.lastUpdateUserId = request.user.sub;
|
||||
employment.lastUpdateFullName = request.user.name;
|
||||
employment.lastUpdatedAt = new Date();
|
||||
history.profileEmployeeEmploymentId = id;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.createdUserId = request.user.sub;
|
||||
history.createdFullName = request.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.employmentRepository.save(employment),
|
||||
|
|
|
|||
|
|
@ -609,6 +609,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
profile.createdFullName = request.user.name;
|
||||
profile.lastUpdateUserId = request.user.sub;
|
||||
profile.lastUpdateFullName = request.user.name;
|
||||
profile.createdAt = new Date();
|
||||
profile.lastUpdatedAt = new Date();
|
||||
profile.dateRetire = calculateRetireDate(profile.birthDate);
|
||||
profile.dateRetireLaw = calculateRetireLaw(profile.birthDate);
|
||||
profile.citizenId = Extension.CheckCitizen(profile.citizenId);
|
||||
|
|
@ -678,6 +680,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
Object.assign(record, body);
|
||||
record.lastUpdateUserId = request.user.sub;
|
||||
record.lastUpdateFullName = request.user.name;
|
||||
record.lastUpdatedAt = new Date();
|
||||
record.dateRetire = calculateRetireDate(record.birthDate);
|
||||
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
||||
record.citizenId = Extension.CheckCitizen(record.citizenId);
|
||||
|
|
@ -2192,6 +2195,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
|
||||
profileEmp.lastUpdateUserId = request.user.sub;
|
||||
profileEmp.lastUpdateFullName = request.user.name;
|
||||
profileEmp.lastUpdatedAt = new Date();
|
||||
profileEmp.nodeTemp = String(body.node);
|
||||
profileEmp.nodeIdTemp = body.nodeId;
|
||||
profileEmp.orgRevisionIdTemp = body.orgRevisionId;
|
||||
|
|
@ -2916,8 +2920,10 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
history.profileEmployeeId = profileEmployeeId;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdatedAt = new Date();
|
||||
profileEmp.lastUpdateUserId = request.user.sub;
|
||||
profileEmp.lastUpdateFullName = request.user.name;
|
||||
profileEmp.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileRepo.save(profileEmp),
|
||||
|
|
@ -3084,6 +3090,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
employment.createdFullName = request.user.name;
|
||||
employment.lastUpdateUserId = request.user.sub;
|
||||
employment.lastUpdateFullName = request.user.name;
|
||||
employment.createdAt = new Date();
|
||||
employment.lastUpdatedAt = new Date();
|
||||
await this.employmentRepository.save(employment);
|
||||
// if (employment) {
|
||||
// Object.assign(history, { ...employment, id: undefined });
|
||||
|
|
@ -3141,9 +3149,11 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
|
||||
employment.lastUpdateUserId = request.user.sub;
|
||||
employment.lastUpdateFullName = request.user.name;
|
||||
employment.lastUpdatedAt = new Date();
|
||||
history.profileEmployeeEmploymentId = id;
|
||||
history.lastUpdateFullName = request.user.name;
|
||||
history.lastUpdateUserId = request.user.sub;
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.employmentRepository.save(employment),
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ export class ProvinceController extends Controller {
|
|||
_province.createdFullName = request.user.name;
|
||||
_province.lastUpdateUserId = request.user.sub;
|
||||
_province.lastUpdateFullName = request.user.name;
|
||||
_province.createdAt = new Date();
|
||||
_province.lastUpdatedAt = new Date();
|
||||
await this.provinceRepository.save(_province);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -127,6 +129,7 @@ export class ProvinceController extends Controller {
|
|||
|
||||
_province.lastUpdateUserId = request.user.sub;
|
||||
_province.lastUpdateFullName = request.user.name;
|
||||
_province.lastUpdatedAt = new Date();
|
||||
this.provinceRepository.merge(_province, requestBody);
|
||||
await this.provinceRepository.save(_province);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ export class RankController extends Controller {
|
|||
rank.createdFullName = request.user.name;
|
||||
rank.lastUpdateUserId = request.user.sub;
|
||||
rank.lastUpdateFullName = request.user.name;
|
||||
rank.createdAt = new Date();
|
||||
rank.lastUpdatedAt = new Date();
|
||||
await this.rankRepository.save(rank);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -88,6 +90,7 @@ export class RankController extends Controller {
|
|||
|
||||
rank.lastUpdateUserId = request.user.sub;
|
||||
rank.lastUpdateFullName = request.user.name;
|
||||
rank.lastUpdatedAt = new Date();
|
||||
this.rankRepository.merge(rank, requestBody);
|
||||
await this.rankRepository.save(rank);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ export class RelationshipController extends Controller {
|
|||
relationship.createdFullName = request.user.name;
|
||||
relationship.lastUpdateUserId = request.user.sub;
|
||||
relationship.lastUpdateFullName = request.user.name;
|
||||
relationship.createdAt = new Date();
|
||||
relationship.lastUpdatedAt = new Date();
|
||||
await this.relationshipRepository.save(relationship);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -88,6 +90,7 @@ export class RelationshipController extends Controller {
|
|||
|
||||
relationship.lastUpdateUserId = request.user.sub;
|
||||
relationship.lastUpdateFullName = request.user.name;
|
||||
relationship.lastUpdatedAt = new Date();
|
||||
this.relationshipRepository.merge(relationship, requestBody);
|
||||
await this.relationshipRepository.save(relationship);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ export class ReligionController extends Controller {
|
|||
religion.createdFullName = request.user.name;
|
||||
religion.lastUpdateUserId = request.user.sub;
|
||||
religion.lastUpdateFullName = request.user.name;
|
||||
religion.createdAt = new Date();
|
||||
religion.lastUpdatedAt = new Date();
|
||||
await this.religionRepository.save(religion);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -88,6 +90,7 @@ export class ReligionController extends Controller {
|
|||
|
||||
religion.lastUpdateUserId = request.user.sub;
|
||||
religion.lastUpdateFullName = request.user.name;
|
||||
religion.lastUpdatedAt = new Date();
|
||||
this.religionRepository.merge(religion, requestBody);
|
||||
await this.religionRepository.save(religion);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ export class SubDistrictController extends Controller {
|
|||
_subDistrict.createdFullName = request.user.name;
|
||||
_subDistrict.lastUpdateUserId = request.user.sub;
|
||||
_subDistrict.lastUpdateFullName = request.user.name;
|
||||
_subDistrict.createdAt = new Date();
|
||||
_subDistrict.lastUpdatedAt = new Date();
|
||||
await this.subDistrictRepository.save(_subDistrict);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -150,6 +152,7 @@ export class SubDistrictController extends Controller {
|
|||
|
||||
_subDistrict.lastUpdateUserId = request.user.sub;
|
||||
_subDistrict.lastUpdateFullName = request.user.name;
|
||||
_subDistrict.lastUpdatedAt = new Date();
|
||||
this.subDistrictRepository.merge(_subDistrict, requestBody);
|
||||
await this.subDistrictRepository.save(_subDistrict);
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue