Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m10s

* 'develop' of github.com:Frappet/bma-ehr-organization:
  Migration add fields isDeleted #210
This commit is contained in:
Warunee Tamkoo 2026-02-12 11:53:55 +07:00
commit 9927c73547
82 changed files with 499 additions and 180 deletions

View file

@ -6679,7 +6679,7 @@ export class CommandController extends Controller {
profileEdu.profileId = profile.id;
const educationLevel = await this.profileEducationRepo.findOne({
select: ["id", "level", "profileId"],
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { level: "DESC" },
});
profileEdu.level = educationLevel == null ? 1 : educationLevel.level + 1;
@ -6871,7 +6871,7 @@ export class CommandController extends Controller {
// Insignia
if (_oldInsigniaIds.length > 0) {
const _insignias = await this.insigniaRepo.find({
where: { id: In(_oldInsigniaIds) },
where: { id: In(_oldInsigniaIds), isDeleted: false },
order: { createdAt: "ASC" },
});
for (const oldInsignia of _insignias) {

View file

@ -2475,8 +2475,8 @@ export class ImportDataController extends Controller {
});
const educationLevel = await this.profileEducationRepo.findOne({
select: ["id", "level", "profileId"],
where: { profileId: _item.id },
select: ["id", "level", "profileId", "isDeleted"],
where: { profileId: _item.id, isDeleted: false },
order: { level: "DESC" },
});
@ -2607,8 +2607,8 @@ export class ImportDataController extends Controller {
});
const educationLevel = await this.profileEducationRepo.findOne({
select: ["id", "level", "profileEmployeeId"],
where: { profileEmployeeId: _item.id },
select: ["id", "level", "profileEmployeeId", "isDeleted"],
where: { profileEmployeeId: _item.id, isDeleted: false },
order: { level: "DESC" },
});
@ -2740,8 +2740,8 @@ export class ImportDataController extends Controller {
});
const educationLevel = await this.profileEducationRepo.findOne({
select: ["id", "level", "profileEmployeeId"],
where: { profileEmployeeId: _item.id },
select: ["id", "level", "profileEmployeeId", "isDeleted"],
where: { profileEmployeeId: _item.id, isDeleted: false },
order: { level: "DESC" },
});
@ -5799,7 +5799,7 @@ export class ImportDataController extends Controller {
},
});
const eduLevel = await this.profileEducationRepo.findOne({
where: { profileId: _item.id },
where: { profileId: _item.id, isDeleted: false },
order: {
startDate: "DESC",
},

View file

@ -1359,7 +1359,7 @@ export class OrganizationDotnetController extends Controller {
order: { commandDateAffect: "DESC" },
}),
this.insigniaRepo.findOne({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { receiveDate: "DESC" },
}),
]);
@ -1542,7 +1542,7 @@ export class OrganizationDotnetController extends Controller {
order: { commandDateAffect: "DESC" },
}),
this.insigniaRepo.findOne({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { receiveDate: "DESC" },
}),
]);
@ -2379,7 +2379,7 @@ export class OrganizationDotnetController extends Controller {
order: { commandDateAffect: "DESC" },
}),
this.insigniaRepo.findOne({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { receiveDate: "DESC" },
}),
]);
@ -2694,7 +2694,7 @@ export class OrganizationDotnetController extends Controller {
order: { commandDateAffect: "DESC" },
}),
this.insigniaRepo.findOne({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { receiveDate: "DESC" },
}),
]);
@ -7441,7 +7441,7 @@ export class OrganizationDotnetController extends Controller {
: [];
const profileEducations = await this.educationRepo.find({
where: { profileEmployeeId: profile!.id },
where: { profileEmployeeId: profile!.id, isDeleted: false },
order: { level: "ASC" },
});
_educations = profileEducations.length > 0
@ -7581,7 +7581,7 @@ export class OrganizationDotnetController extends Controller {
: [];
const profileEducations = await this.educationRepo.find({
where: { profileId: profile!.id },
where: { profileId: profile!.id, isDeleted: false },
order: { level: "ASC" },
});
_educations = profileEducations.length > 0

View file

@ -423,6 +423,7 @@ export class OrganizationUnauthorizeController extends Controller {
year: body.year.toString(),
pointSum: MoreThanOrEqual(90),
period: body.period.toLocaleUpperCase(),
isDeleted: false
}
}
);
@ -884,6 +885,7 @@ export class OrganizationUnauthorizeController extends Controller {
year: body.year.toString(),
pointSum: MoreThanOrEqual(90),
period: body.period.toLocaleUpperCase(),
isDeleted: false
}
}
);
@ -1088,7 +1090,7 @@ export class OrganizationUnauthorizeController extends Controller {
order: { commandDateAffect: "DESC" },
}),
this.insigniaRepo.findOne({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { receiveDate: "DESC" },
}),
]);
@ -1403,7 +1405,7 @@ export class OrganizationUnauthorizeController extends Controller {
order: { commandDateAffect: "DESC" },
}),
this.insigniaRepo.findOne({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { receiveDate: "DESC" },
}),
]);

View file

@ -598,6 +598,7 @@ export class PosMasterActController extends Controller {
"lastUpdateFullName",
"lastUpdatedAt",
"dateEnd",
"isDeleted"
],
where: { profileId, status: true, isDeleted: false },
});

View file

@ -40,7 +40,7 @@ export class ProfileAbilityController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAbilityId = await this.profileAbilityRepo.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAbilityId) {
@ -55,7 +55,7 @@ export class ProfileAbilityController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const getProfileAbilityId = await this.profileAbilityRepo.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAbilityId) {

View file

@ -40,7 +40,7 @@ export class ProfileAbilityEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAbilityId = await this.profileAbilityRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAbilityId) {
@ -58,7 +58,7 @@ export class ProfileAbilityEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const getProfileAbilityId = await this.profileAbilityRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAbilityId) {

View file

@ -40,7 +40,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAbilityId = await this.profileAbilityRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAbilityId) {
@ -57,7 +57,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileAbilityId = await this.profileAbilityRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAbilityId) {

View file

@ -41,7 +41,7 @@ export class ProfileAssessmentsController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAssessments = await this.profileAssessmentsRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssessments) {
@ -59,7 +59,7 @@ export class ProfileAssessmentsController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const getProfileAssessments = await this.profileAssessmentsRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssessments) {

View file

@ -41,7 +41,7 @@ export class ProfileAssessmentsEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAssessments = await this.profileAssessmentsRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssessments) {
@ -61,6 +61,7 @@ export class ProfileAssessmentsEmployeeController extends Controller {
const getProfileAssessments = await this.profileAssessmentsRepository.find({
where: {
profileEmployeeId: profileEmployeeId,
isDeleted: false
},
order: { createdAt: "ASC" },
});

View file

@ -41,7 +41,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAssessments = await this.profileAssessmentsRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssessments) {
@ -60,6 +60,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
const getProfileAssessments = await this.profileAssessmentsRepository.find({
where: {
profileEmployeeId: profileEmployeeId,
isDeleted: false
},
order: { createdAt: "ASC" },
});

View file

@ -40,7 +40,7 @@ export class ProfileAssistanceController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAssistanceId = await this.profileAssistanceRepo.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssistanceId) {
@ -55,7 +55,7 @@ export class ProfileAssistanceController extends Controller {
// if (_workflow == false)
// await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const getProfileAssistanceId = await this.profileAssistanceRepo.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssistanceId) {

View file

@ -40,7 +40,7 @@ export class ProfileAssistanceEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAssistanceId = await this.profileAssistanceRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssistanceId) {
@ -58,7 +58,7 @@ export class ProfileAssistanceEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const getProfileAssistanceId = await this.profileAssistanceRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssistanceId) {

View file

@ -40,7 +40,7 @@ export class ProfileAssistanceEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAssistanceId = await this.profileAssistanceRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssistanceId) {
@ -57,7 +57,7 @@ export class ProfileAssistanceEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileAssistanceId = await this.profileAssistanceRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
if (!getProfileAssistanceId) {

View file

@ -40,7 +40,7 @@ export class ProfileCertificateController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.certificateRepo.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -52,7 +52,7 @@ export class ProfileCertificateController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const record = await this.certificateRepo.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -40,7 +40,7 @@ export class ProfileCertificateEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.certificateRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -52,7 +52,7 @@ export class ProfileCertificateEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const record = await this.certificateRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -40,7 +40,7 @@ export class ProfileCertificateEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.certificateRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -51,7 +51,7 @@ export class ProfileCertificateEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.certificateRepo.find({
where: { profileEmployeeId },
where: { profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -41,7 +41,7 @@ export class ProfileChangeNameController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.changeNameRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -53,7 +53,7 @@ export class ProfileChangeNameController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.changeNameRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -41,7 +41,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.changeNameRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -53,7 +53,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const lists = await this.changeNameRepository.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -41,7 +41,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.changeNameRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -52,7 +52,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.changeNameRepository.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -41,7 +41,7 @@ export class ProfileChildrenController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.childrenRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -53,7 +53,7 @@ export class ProfileChildrenController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.childrenRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -41,7 +41,7 @@ export class ProfileChildrenEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.childrenRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -53,7 +53,7 @@ export class ProfileChildrenEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const lists = await this.childrenRepository.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -41,7 +41,7 @@ export class ProfileChildrenEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.childrenRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -52,7 +52,7 @@ export class ProfileChildrenEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.childrenRepository.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -322,8 +322,8 @@ export class ProfileController extends Controller {
];
const educations = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileId: id },
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { level: "ASC" },
});
const Education =
@ -575,8 +575,8 @@ export class ProfileController extends Controller {
let _child4 = child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileId: id },
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
select: ["certificateType", "issuer", "certificateNo", "issueDate", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const certs =
@ -596,8 +596,8 @@ export class ProfileController extends Controller {
},
];
const training_raw = await this.trainingRepository.find({
select: ["startDate", "endDate", "place", "department", "name"],
where: { profileId: id },
select: ["startDate", "endDate", "place", "department", "name", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const trainings =
@ -633,8 +633,8 @@ export class ProfileController extends Controller {
];
const discipline_raw = await this.disciplineRepository.find({
select: ["refCommandDate", "refCommandNo", "detail"],
where: { profileId: id },
select: ["refCommandDate", "refCommandNo", "detail", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const disciplines =
@ -655,8 +655,8 @@ export class ProfileController extends Controller {
];
const education_raw = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileId: id },
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
where: { profileId: id, isDeleted: false },
// order: { lastUpdatedAt: "DESC" },
order: { level: "ASC" },
});
@ -756,7 +756,7 @@ export class ProfileController extends Controller {
insigniaType: true,
},
},
where: { profileId: id },
where: { profileId: id, isDeleted: false },
order: { receiveDate: "ASC" },
});
const insignias =
@ -796,7 +796,7 @@ export class ProfileController extends Controller {
const leave_raw = await this.profileLeaveRepository.find({
relations: { leaveType: true },
where: { profileId: id },
where: { profileId: id, isDeleted: false },
order: { dateLeaveStart: "ASC" },
});
const leaves =
@ -1052,8 +1052,8 @@ export class ProfileController extends Controller {
let _child4 = child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileId: id },
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate"],
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const certs =
@ -1087,8 +1087,8 @@ export class ProfileController extends Controller {
},
];
const training_raw = await this.trainingRepository.find({
select: ["place", "department", "name", "duration"],
where: { profileId: id },
select: ["place", "department", "name", "duration", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const trainings =
@ -1109,8 +1109,8 @@ export class ProfileController extends Controller {
];
const discipline_raw = await this.disciplineRepository.find({
select: ["refCommandDate", "refCommandNo", "detail", "level"],
where: { profileId: id },
select: ["refCommandDate", "refCommandNo", "detail", "level", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const disciplines =
@ -1135,6 +1135,7 @@ export class ProfileController extends Controller {
const education_raw = await this.profileEducationRepo
.createQueryBuilder("education")
.where("education.profileId = :profileId", { profileId: id })
.andWhere("education.isDeleted = :isDeleted", { isDeleted: false })
.orderBy("CASE WHEN education.isEducation = true THEN 1 ELSE 2 END", "ASC")
.addOrderBy("education.level", "ASC")
.getMany();
@ -1245,13 +1246,14 @@ export class ProfileController extends Controller {
"page",
"refCommandDate",
"note",
"isDeleted"
],
relations: {
insignia: {
insigniaType: true,
},
},
where: { profileId: id },
where: { profileId: id, isDeleted: false },
order: { receiveDate: "ASC" },
});
const insignias =
@ -1294,6 +1296,7 @@ export class ProfileController extends Controller {
.createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType")
.select([
"profileLeave.isDeleted",
"profileLeave.leaveTypeId",
"leaveType.name as name",
"leaveType.code as code",
@ -1303,6 +1306,7 @@ export class ProfileController extends Controller {
])
.addSelect("SUM(profileLeave.leaveDays)", "totalLeaveDays")
.where("profileLeave.profileId = :profileId", { profileId: id })
.andWhere("profileLeave.isDeleted = :isDeleted", { isDeleted: false })
.andWhere("profileLeave.status = :status", { status: "approve" })
.groupBy("profileLeave.leaveTypeId")
.orderBy("code", "ASC")
@ -1354,6 +1358,7 @@ export class ProfileController extends Controller {
.createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType")
.select([
"profileLeave.isDeleted AS isDeleted",
"profileLeave.dateLeaveStart AS dateLeaveStart",
"profileLeave.dateLeaveEnd AS dateLeaveEnd",
"profileLeave.leaveDays AS leaveDays",
@ -1361,6 +1366,7 @@ export class ProfileController extends Controller {
"leaveType.name as name",
])
.where("profileLeave.profileId = :profileId", { profileId: id })
.andWhere("profileLeave.isDeleted = :isDeleted", { isDeleted: false })
.andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] })
.andWhere("profileLeave.status = :status", { status: "approve" })
.orderBy("leaveType.code", "ASC")
@ -1387,7 +1393,7 @@ export class ProfileController extends Controller {
},
];
const children_raw = await this.profileChildrenRepository.find({
where: { profileId: id },
where: { profileId: id, isDeleted: false },
});
const children =
children_raw.length > 0
@ -1410,7 +1416,7 @@ export class ProfileController extends Controller {
},
];
const changeName_raw = await this.changeNameRepository.find({
where: { profileId: id },
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const changeName =
@ -1504,13 +1510,13 @@ export class ProfileController extends Controller {
];
const actposition_raw = await this.profileActpositionRepo.find({
select: ["dateStart", "dateEnd", "position"],
select: ["dateStart", "dateEnd", "position", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const assistance_raw = await this.profileAssistanceRepository.find({
select: ["dateStart", "dateEnd", "commandName", "agency", "document"],
where: { profileId: id },
select: ["dateStart", "dateEnd", "commandName", "agency", "document", "isDeleted"],
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
@ -1566,7 +1572,7 @@ export class ProfileController extends Controller {
];
const actposition = [..._actposition, ..._assistance];
const duty_raw = await this.dutyRepository.find({
where: { profileId: id },
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const duty =
@ -1593,7 +1599,7 @@ export class ProfileController extends Controller {
},
];
const assessments_raw = await this.profileAssessmentsRepository.find({
where: { profileId: id },
where: { profileId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const assessments =
@ -9093,7 +9099,7 @@ export class ProfileController extends Controller {
)?.posMasterNo;
const latestProfileEducation = await this.profileEducationRepo.findOne({
where: { profileId: item.id },
where: { profileId: item.id, isDeleted: false },
order: { level: "ASC" },
});
@ -11106,7 +11112,7 @@ export class ProfileController extends Controller {
}
const latestProfileEducation = await this.profileEducationRepo.findOne({
where: { profileId: item.id },
where: { profileId: item.id, isDeleted: false },
order: { level: "ASC" },
});

View file

@ -40,7 +40,7 @@ export class ProfileDisciplineController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.disciplineRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -52,7 +52,7 @@ export class ProfileDisciplineController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.disciplineRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -63,7 +63,7 @@ export class ProfileDisciplineController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_SALARY_OFFICER");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
const lists = await this.disciplineRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -40,7 +40,7 @@ export class ProfileDisciplineEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -52,7 +52,7 @@ export class ProfileDisciplineEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -63,7 +63,7 @@ export class ProfileDisciplineEmployeeController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -40,7 +40,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -51,7 +51,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -62,7 +62,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_WAGE");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
const lists = await this.disciplineRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -36,7 +36,7 @@ export class ProfileDutyController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.dutyRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -48,7 +48,7 @@ export class ProfileDutyController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.dutyRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -36,7 +36,7 @@ export class ProfileDutyEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.dutyRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -48,7 +48,7 @@ export class ProfileDutyEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const lists = await this.dutyRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -36,7 +36,7 @@ export class ProfileDutyEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.dutyRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -47,7 +47,7 @@ export class ProfileDutyEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.dutyRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -42,7 +42,7 @@ export class ProfileEducationsController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { level: "ASC" },
});
if (!getProfileEducation) {
@ -57,7 +57,7 @@ export class ProfileEducationsController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { level: "ASC" },
});
if (!getProfileEducation) {

View file

@ -42,7 +42,7 @@ export class ProfileEducationsEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { level: "ASC" },
});
if (!getProfileEducation) {
@ -60,7 +60,7 @@ export class ProfileEducationsEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { level: "ASC" },
});
if (!getProfileEducation) {

View file

@ -42,7 +42,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { level: "ASC" },
});
if (!getProfileEducation) {
@ -59,7 +59,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const getProfileEducation = await this.profileEducationRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { level: "ASC" },
});
if (!getProfileEducation) {

View file

@ -317,8 +317,8 @@ export class ProfileEmployeeController extends Controller {
];
const educations = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id },
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { level: "ASC" },
});
const Education =
@ -571,8 +571,8 @@ export class ProfileEmployeeController extends Controller {
let _child4 = child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileEmployeeId: id },
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
select: ["certificateType", "issuer", "certificateNo", "issueDate", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const certs =
@ -592,8 +592,8 @@ export class ProfileEmployeeController extends Controller {
},
];
const training_raw = await this.trainingRepository.find({
select: ["startDate", "endDate", "place", "department"],
where: { profileEmployeeId: id },
select: ["startDate", "endDate", "place", "department", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const trainings =
@ -629,8 +629,8 @@ export class ProfileEmployeeController extends Controller {
];
const discipline_raw = await this.disciplineRepository.find({
select: ["refCommandDate", "refCommandNo", "detail"],
where: { profileEmployeeId: id },
select: ["refCommandDate", "refCommandNo", "detail", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const disciplines =
@ -651,8 +651,8 @@ export class ProfileEmployeeController extends Controller {
];
const education_raw = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id },
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
// order: { lastUpdatedAt: "DESC" },
order: { level: "ASC" },
});
@ -752,7 +752,7 @@ export class ProfileEmployeeController extends Controller {
insigniaType: true,
},
},
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { receiveDate: "ASC" },
});
const insignias =
@ -792,7 +792,7 @@ export class ProfileEmployeeController extends Controller {
const leave_raw = await this.profileLeaveRepository.find({
relations: { leaveType: true },
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { dateLeaveStart: "ASC" },
});
const leaves =
@ -1048,8 +1048,8 @@ export class ProfileEmployeeController extends Controller {
let _child4 = child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileEmployeeId: id },
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate"],
select: ["certificateType", "issuer", "certificateNo", "issueDate", "expireDate", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const certs =
@ -1083,8 +1083,8 @@ export class ProfileEmployeeController extends Controller {
},
];
const training_raw = await this.trainingRepository.find({
select: ["place", "department", "name", "duration"],
where: { profileEmployeeId: id },
select: ["place", "department", "name", "duration", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const trainings =
@ -1105,8 +1105,8 @@ export class ProfileEmployeeController extends Controller {
];
const discipline_raw = await this.disciplineRepository.find({
select: ["refCommandDate", "refCommandNo", "detail", "level"],
where: { profileEmployeeId: id },
select: ["refCommandDate", "refCommandNo", "detail", "level", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const disciplines =
@ -1131,6 +1131,7 @@ export class ProfileEmployeeController extends Controller {
const education_raw = await this.profileEducationRepo
.createQueryBuilder("education")
.where("education.profileEmployeeId = :profileId", { profileId: id })
.andWhere("education.isDeleted = :isDeleted", { isDeleted: false })
.orderBy("CASE WHEN education.isEducation = true THEN 1 ELSE 2 END", "ASC")
.addOrderBy("education.level", "ASC")
.getMany();
@ -1241,13 +1242,14 @@ export class ProfileEmployeeController extends Controller {
"page",
"refCommandDate",
"note",
"isDeleted"
],
relations: {
insignia: {
insigniaType: true,
},
},
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { receiveDate: "ASC" },
});
const insignias =
@ -1290,6 +1292,7 @@ export class ProfileEmployeeController extends Controller {
.createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType")
.select([
"profileLeave.isDeleted",
"profileLeave.leaveTypeId",
"leaveType.name as name",
"leaveType.code as code",
@ -1299,6 +1302,7 @@ export class ProfileEmployeeController extends Controller {
])
.addSelect("SUM(profileLeave.leaveDays)", "totalLeaveDays")
.where("profileLeave.profileEmployeeId = :profileId", { profileId: id })
.andWhere("profileLeave.isDeleted = :isDeleted", { isDeleted: false })
.andWhere("profileLeave.status = :status", { status: "approve" })
.groupBy("profileLeave.leaveTypeId")
.orderBy("code", "ASC")
@ -1350,6 +1354,7 @@ export class ProfileEmployeeController extends Controller {
.createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType")
.select([
"profileLeave.isDeleted AS isDeleted",
"profileLeave.dateLeaveStart AS dateLeaveStart",
"profileLeave.dateLeaveEnd AS dateLeaveEnd",
"profileLeave.leaveDays AS leaveDays",
@ -1357,6 +1362,7 @@ export class ProfileEmployeeController extends Controller {
"leaveType.name as name",
])
.where("profileLeave.profileEmployeeId = :profileId", { profileId: id })
.andWhere("profileLeave.isDeleted = :isDeleted", { isDeleted: false })
.andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] })
.andWhere("profileLeave.status = :status", { status: "approve" })
.orderBy("leaveType.code", "ASC")
@ -1383,7 +1389,7 @@ export class ProfileEmployeeController extends Controller {
},
];
const children_raw = await this.profileChildrenRepository.find({
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
});
const children =
children_raw.length > 0
@ -1406,7 +1412,7 @@ export class ProfileEmployeeController extends Controller {
},
];
const changeName_raw = await this.changeNameRepository.find({
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const changeName =
@ -1500,13 +1506,13 @@ export class ProfileEmployeeController extends Controller {
];
const actposition_raw = await this.profileActpositionRepo.find({
select: ["dateStart", "dateEnd", "position"],
select: ["dateStart", "dateEnd", "position", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const assistance_raw = await this.profileAssistanceRepository.find({
select: ["dateStart", "dateEnd", "commandName", "agency", "document"],
where: { profileEmployeeId: id },
select: ["dateStart", "dateEnd", "commandName", "agency", "document", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
@ -1562,7 +1568,7 @@ export class ProfileEmployeeController extends Controller {
];
const actposition = [..._actposition, ..._assistance];
const duty_raw = await this.dutyRepository.find({
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const duty =
@ -1589,7 +1595,7 @@ export class ProfileEmployeeController extends Controller {
},
];
const assessments_raw = await this.profileAssessmentsRepository.find({
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const assessments =
@ -3854,7 +3860,7 @@ export class ProfileEmployeeController extends Controller {
)?.posMasterNo;
const latestProfileEducation = await this.profileEducationRepo.findOne({
where: { profileEmployeeId: item.id },
where: { profileEmployeeId: item.id, isDeleted: false },
order: { level: "ASC" },
});
@ -5953,7 +5959,7 @@ export class ProfileEmployeeController extends Controller {
}
const latestProfileEducation = await this.profileEducationRepo.findOne({
where: { profileEmployeeId: item.id },
where: { profileEmployeeId: item.id, isDeleted: false },
order: { level: "ASC" },
});

View file

@ -289,8 +289,8 @@ export class ProfileEmployeeTempController extends Controller {
},
];
const educations = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id },
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { level: "ASC" },
});
const Education =
@ -547,8 +547,8 @@ export class ProfileEmployeeTempController extends Controller {
let _child4 = child4?.orgChild4Name;
const cert_raw = await this.certificateRepository.find({
where: { profileEmployeeId: id },
select: ["certificateType", "issuer", "certificateNo", "issueDate"],
select: ["certificateType", "issuer", "certificateNo", "issueDate", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" },
});
const certs =
@ -627,8 +627,8 @@ export class ProfileEmployeeTempController extends Controller {
];
const education_raw = await this.profileEducationRepo.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id },
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false },
// order: { lastUpdatedAt: "DESC" },
order: { level: "ASC" },
});
@ -734,7 +734,7 @@ export class ProfileEmployeeTempController extends Controller {
insigniaType: true,
},
},
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { receiveDate: "ASC" },
});
const insignias =
@ -774,7 +774,7 @@ export class ProfileEmployeeTempController extends Controller {
const leave_raw = await this.profileLeaveRepository.find({
relations: { leaveType: true },
where: { profileEmployeeId: id },
where: { profileEmployeeId: id, isDeleted: false },
order: { dateLeaveStart: "ASC" },
});
const leaves =
@ -2370,7 +2370,7 @@ export class ProfileEmployeeTempController extends Controller {
)?.posMasterNo;
const latestProfileEducation = await this.profileEducationRepo.findOne({
where: { profileEmployeeId: item.id },
where: { profileEmployeeId: item.id, isDeleted: false },
order: { level: "ASC" },
});
@ -4043,7 +4043,7 @@ export class ProfileEmployeeTempController extends Controller {
)?.posMasterNo;
const latestProfileEducation = await this.profileEducationRepo.findOne({
where: { profileEmployeeId: item.id },
where: { profileEmployeeId: item.id, isDeleted: false },
order: { level: "ASC" },
});

View file

@ -36,7 +36,7 @@ export class ProfileHonorController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.honorRepo.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -48,7 +48,7 @@ export class ProfileHonorController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const record = await this.honorRepo.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -40,7 +40,7 @@ export class ProfileHonorEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.honorRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -52,7 +52,7 @@ export class ProfileHonorEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const record = await this.honorRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -40,7 +40,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.honorRepo.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -51,7 +51,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileEmployeeId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.honorRepo.find({
where: { profileEmployeeId: profileEmployeeId },
where: { profileEmployeeId: profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -50,7 +50,7 @@ export class ProfileInsigniaController extends Controller {
insigniaType: true,
},
},
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -67,7 +67,7 @@ export class ProfileInsigniaController extends Controller {
insigniaType: true,
},
},
where: { profileId },
where: { profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -47,7 +47,7 @@ export class ProfileInsigniaEmployeeController extends Controller {
insigniaType: true,
},
},
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -64,7 +64,7 @@ export class ProfileInsigniaEmployeeController extends Controller {
insigniaType: true,
},
},
where: { profileEmployeeId },
where: { profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -47,7 +47,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
insigniaType: true,
},
},
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -63,7 +63,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
insigniaType: true,
},
},
where: { profileEmployeeId },
where: { profileEmployeeId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -120,7 +120,7 @@ export class ProfileLeaveController extends Controller {
}
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -136,6 +136,7 @@ export class ProfileLeaveController extends Controller {
where: {
profileId: profileId,
// status: Not("cancel")
isDeleted: false
},
order: { createdAt: "ASC" },
});
@ -148,7 +149,7 @@ export class ProfileLeaveController extends Controller {
if (_workflow == false) await new permission().PermissionGet(req, "SYS_SALARY_OFFICER");
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileId },
where: { profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -43,7 +43,7 @@ export class ProfileLeaveEmployeeController extends Controller {
}
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -56,7 +56,7 @@ export class ProfileLeaveEmployeeController extends Controller {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -68,7 +68,7 @@ export class ProfileLeaveEmployeeController extends Controller {
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -43,7 +43,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
}
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -55,7 +55,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);
@ -67,7 +67,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
if (_workflow == false) await new permission().PermissionGet(req, "SYS_WAGE");
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);

View file

@ -36,7 +36,7 @@ export class ProfileNopaidController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.nopaidRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -48,7 +48,7 @@ export class ProfileNopaidController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.nopaidRepository.find({
where: { profileId },
where: { profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -40,7 +40,7 @@ export class ProfileNopaidEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.nopaidRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -51,7 +51,7 @@ export class ProfileNopaidEmployeeController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_EMP");
const lists = await this.nopaidRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -40,7 +40,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.nopaidRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -51,7 +51,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.nopaidRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -37,7 +37,7 @@ export class ProfileOtherController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.otherRepository.find({
where: { profileId: profile.id },
where: { profileId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -49,7 +49,7 @@ export class ProfileOtherController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.otherRepository.find({
where: { profileId: profileId },
where: { profileId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -40,7 +40,7 @@ export class ProfileOtherEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.otherRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -52,7 +52,7 @@ export class ProfileOtherEmployeeController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const lists = await this.otherRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -40,7 +40,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.otherRepository.find({
where: { profileEmployeeId: profile.id },
where: { profileEmployeeId: profile.id, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
@ -51,7 +51,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_TEMP");
if (_workflow == false) await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const lists = await this.otherRepository.find({
where: { profileEmployeeId: profileId },
where: { profileEmployeeId: profileId, isDeleted: false },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);

View file

@ -3659,8 +3659,9 @@ export class ReportController extends Controller {
if (profileIds.length > 0) {
educationsData = await this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...profileIds)", { profileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -3844,8 +3845,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child1ProfileIds)", { child1ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -4025,8 +4027,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child2ProfileIds)", { child2ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -4206,8 +4209,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child3ProfileIds)", { child3ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -4385,8 +4389,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child4ProfileIds)", { child4ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -8955,8 +8960,9 @@ export class ReportController extends Controller {
if (profileIds.length > 0) {
educationsData = await this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...profileIds)", { profileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -9146,8 +9152,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child1ProfileIds)", { child1ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -9333,8 +9340,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child2ProfileIds)", { child2ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -9521,8 +9529,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child3ProfileIds)", { child3ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,
@ -9708,8 +9717,9 @@ export class ReportController extends Controller {
this.profileEducationRepository
.createQueryBuilder("pe")
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level"])
.select(["pe.profileId", "pe.finishDate", "pe.degree", "pe.level", "pe.isDeleted"])
.where("pe.profileId IN (:...child4ProfileIds)", { child4ProfileIds })
.andWhere("pe.isDeleted = :isDeleted", { isDeleted: false })
.andWhere(
`(pe.profileId, COALESCE(pe.finishDate, '1900-01-01'), pe.level) IN (
SELECT pe2.profileId,

View file

@ -82,6 +82,13 @@ export class ProfileAbility extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(
() => ProfileAbilityHistory,
(profileAbilityHistory) => profileAbilityHistory.histories,

View file

@ -66,6 +66,13 @@ export class ProfileAbilityHistory extends EntityBase {
})
profileAbilityId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => ProfileAbility, (profileAbility) => profileAbility.profileAbilityHistorys)
@JoinColumn({ name: "profileAbilityId" })
histories: ProfileAbility;

View file

@ -100,6 +100,13 @@ export class ProfileAssessment extends EntityBase {
})
pointSumTotal: number;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(
() => ProfileAssessmentHistory,
(profileAssessmentHistory) => profileAssessmentHistory.histories,

View file

@ -96,6 +96,13 @@ export class ProfileAssessmentHistory extends EntityBase {
})
profileAssessmentId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(
() => ProfileAssessment,
(profileAssessment) => profileAssessment.profileAssessmentHistorys,

View file

@ -94,6 +94,13 @@ export class ProfileAssistance extends EntityBase {
})
commandId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => Command, (command) => command.profileSalarys)
@JoinColumn({ name: "commandId" })
command: Command;

View file

@ -62,6 +62,13 @@ export class ProfileAssistanceHistory extends EntityBase {
})
profileAssistanceId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(
() => ProfileAssistance,
(profileAssistance) => profileAssistance.profileAssistanceHistorys,

View file

@ -74,6 +74,13 @@ export class ProfileCertificate extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(
() => ProfileCertificateHistory,
(profileCertificateHistory) => profileCertificateHistory.histories,

View file

@ -58,6 +58,13 @@ export class ProfileCertificateHistory extends EntityBase {
})
profileCertificateId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(
() => ProfileCertificate,
(profileCertificate) => profileCertificate.profileCertificateHistories,

View file

@ -77,6 +77,13 @@ export class ProfileChangeName extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(
() => ProfileChangeNameHistory,
(profileChangeNameHistory) => profileChangeNameHistory.histories,

View file

@ -60,6 +60,13 @@ export class ProfileChangeNameHistory extends EntityBase {
})
profileChangeNameId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(
() => ProfileChangeName,
(profileChangeName) => profileChangeName.profileChangeNameHistories,

View file

@ -72,6 +72,13 @@ export class ProfileChildren extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => Profile, (Profile) => Profile.profileChildrens)
@JoinColumn({ name: "profileId" })
profile: Profile;

View file

@ -55,6 +55,13 @@ export class ProfileChildrenHistory extends EntityBase {
})
profileChildrenId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
// @ManyToOne(() => ProfileChildren, (profileChildren) => profileChildren.profileChildrenHistories)
// @JoinColumn({ name: "profileChildrenId" })
// histories: ProfileChildren;

View file

@ -82,6 +82,13 @@ export class ProfileDiscipline extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(
() => ProfileDisciplineHistory,
(profileDisciplineHistory) => profileDisciplineHistory.histories,

View file

@ -65,6 +65,13 @@ export class ProfileDisciplineHistory extends EntityBase {
})
isUpload: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(
() => ProfileDiscipline,
(profileDiscipline) => profileDiscipline.profileDisciplineHistories,

View file

@ -82,6 +82,13 @@ export class ProfileDuty extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(() => ProfileDutyHistory, (profileDutyHistory) => profileDutyHistory.histories)
profileDutyHistories: ProfileDutyHistory[];

View file

@ -66,6 +66,13 @@ export class ProfileDutyHistory extends EntityBase {
})
profileDutyId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => ProfileDuty, (profileDuty) => profileDuty.profileDutyHistories)
@JoinColumn({ name: "profileDutyId" })
histories: ProfileDuty;

View file

@ -196,6 +196,13 @@ export class ProfileEducation extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(
() => ProfileEducationHistory,
(profileEducationHistory) => profileEducationHistory.histories,

View file

@ -166,6 +166,13 @@ export class ProfileEducationHistory extends EntityBase {
})
profileEducationId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(
() => ProfileEducation,
(profileEducation) => profileEducation.profileEducationHistories,

View file

@ -89,6 +89,13 @@ export class ProfileHonor extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(() => ProfileHonorHistory, (profileHonorHistory) => profileHonorHistory.histories)
profileHonorHistories: ProfileHonorHistory[];

View file

@ -73,6 +73,13 @@ export class ProfileHonorHistory extends EntityBase {
})
isUpload: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => ProfileHonor, (profileHonor) => profileHonor.profileHonorHistories)
@JoinColumn({ name: "profileHonorId" })
histories: ProfileHonor;

View file

@ -137,6 +137,13 @@ export class ProfileInsignia extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => Insignia, (v) => v.profileInsignias)
insignia: Insignia;

View file

@ -65,6 +65,13 @@ export class ProfileInsigniaHistory extends EntityBase {
})
profileInsigniaId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => ProfileInsignia, (profileInsignia) => profileInsignia.profileInsigniaHistories)
@JoinColumn({ name: "profileInsigniaId" })
histories: ProfileInsignia;

View file

@ -100,6 +100,13 @@ export class ProfileLeave extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(() => ProfileLeaveHistory, (v) => v.profileLeave)
histories: ProfileLeaveHistory[];
@ -124,6 +131,13 @@ export class ProfileLeaveHistory extends ProfileLeave {
})
profileLeaveId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean = false;
@ManyToOne(() => ProfileLeave, (v) => v.histories)
profileLeave: ProfileLeave;
}

View file

@ -74,6 +74,13 @@ export class ProfileNopaid extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(() => ProfileNopaidHistory, (profileNopaidHistory) => profileNopaidHistory.histories)
profileNopaidHistories: ProfileNopaidHistory[];

View file

@ -58,6 +58,13 @@ export class ProfileNopaidHistory extends EntityBase {
})
profileNopaidId: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => ProfileNopaid, (profileNopaid) => profileNopaid.profileNopaidHistories)
@JoinColumn({ name: "profileNopaidId" })
histories: ProfileNopaid;

View file

@ -44,6 +44,13 @@ export class ProfileOther extends EntityBase {
})
isEntry: boolean;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@OneToMany(() => ProfileOtherHistory, (profileOtherHistory) => profileOtherHistory.histories)
profileOtherHistories: ProfileOtherHistory[];

View file

@ -28,6 +28,13 @@ export class ProfileOtherHistory extends EntityBase {
})
date: Date;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => ProfileOther, (profileOther) => profileOther.profileOtherHistories)
@JoinColumn({ name: "profileOtherId" })
histories: ProfileOther;

View file

@ -287,6 +287,13 @@ export class ProfileSalary extends EntityBase {
})
positionArea: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => Command, (command) => command.profileSalarys)
@JoinColumn({ name: "commandId" })
command: Command;

View file

@ -292,4 +292,11 @@ export class ProfileSalaryBackup extends EntityBase {
})
positionArea: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
}

View file

@ -228,6 +228,13 @@ export class ProfileSalaryHistory extends EntityBase {
})
posNumCodeSitAbb: string;
@Column({
nullable: false,
comment: "สถานะลบข้อมูล",
default: false,
})
isDeleted: boolean;
@ManyToOne(() => Command, (command) => command.profileSalaryHistorys)
@JoinColumn({ name: "commandId" })
command: Command;

View file

@ -0,0 +1,74 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddFieldsIsDeleted1770870836370 implements MigrationInterface {
name = 'AddFieldsIsDeleted1770870836370'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileCertificateHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileCertificate\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileInsignia\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileHonor\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssessmentHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssessment\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileLeave\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDutyHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDuty\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileNopaidHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileNopaid\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChangeNameHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChangeName\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEducation\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAbilityHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAbility\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileOther\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileChildren\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssistanceHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileAssistance\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileSalaryBackup\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalaryBackup\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssistance\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssistanceHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChildren\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileOther\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAbility\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAbilityHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileEducation\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChangeName\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileChangeNameHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileNopaid\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileNopaidHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDuty\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileDutyHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileLeaveHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileLeave\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssessment\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileAssessmentHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileHonor\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileInsignia\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileCertificate\` DROP COLUMN \`isDeleted\``);
await queryRunner.query(`ALTER TABLE \`profileCertificateHistory\` DROP COLUMN \`isDeleted\``);
}
}