Migration add fields isDeleted #210
This commit is contained in:
parent
3c9e3a1bb6
commit
65e3740cc2
82 changed files with 499 additions and 180 deletions
|
|
@ -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" },
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue