delete view
This commit is contained in:
parent
999e77582e
commit
f61290b49d
1 changed files with 2 additions and 40 deletions
|
|
@ -31,7 +31,7 @@ import {
|
|||
UpdateProfileMother,
|
||||
UpdateProfileCouple,
|
||||
} from "../entities/Profile";
|
||||
import { Any, Brackets, In, IsNull, Like, Not } from "typeorm";
|
||||
import { Brackets, IsNull, Like, Not } from "typeorm";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
import { PosMaster } from "../entities/PosMaster";
|
||||
import { PosLevel } from "../entities/PosLevel";
|
||||
|
|
@ -40,7 +40,6 @@ import {
|
|||
calculateAge,
|
||||
calculateRetireDate,
|
||||
calculateRetireLaw,
|
||||
calculateRetireYear,
|
||||
removeProfileInOrganize,
|
||||
setLogDataDiff,
|
||||
} from "../interfaces/utils";
|
||||
|
|
@ -54,22 +53,17 @@ import { ProfileCertificate } from "../entities/ProfileCertificate";
|
|||
import { ProfileTraining } from "../entities/ProfileTraining";
|
||||
import { ProfileDiscipline } from "../entities/ProfileDiscipline";
|
||||
import { ProfileEducation } from "../entities/ProfileEducation";
|
||||
import { CreateProfileSalary, ProfileSalary } from "../entities/ProfileSalary";
|
||||
import { ProfileSalary } from "../entities/ProfileSalary";
|
||||
import { ProfileFamilyCouple } from "../entities/ProfileFamilyCouple";
|
||||
import { ProfileFamilyMother } from "../entities/ProfileFamilyMother";
|
||||
import { ProfileFamilyFather } from "../entities/ProfileFamilyFather";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import Extension from "../interfaces/extension";
|
||||
import { Prefixe } from "../entities/Prefixe";
|
||||
import { ProfileInsignia } from "../entities/ProfileInsignia";
|
||||
import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory";
|
||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||
import { updateName } from "../keycloak";
|
||||
import permission from "../interfaces/permission";
|
||||
import { PosMasterAct } from "../entities/PosMasterAct";
|
||||
import axios from "axios";
|
||||
import { OrgChild1 } from "../entities/OrgChild1";
|
||||
import { viewCommanderDirector } from "../entities/view/viewCommanderDirector";
|
||||
import { ProfileFamilyFatherHistory } from "../entities/ProfileFamilyFatherHistory";
|
||||
import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHistory";
|
||||
import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory";
|
||||
|
|
@ -107,17 +101,13 @@ export class ProfileController extends Controller {
|
|||
private educationRepository = AppDataSource.getRepository(ProfileEducation);
|
||||
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
|
||||
private profileEducationRepository = AppDataSource.getRepository(ProfileEducation);
|
||||
private prefixRepo = AppDataSource.getRepository(Prefixe);
|
||||
private provinceRepo = AppDataSource.getRepository(Province);
|
||||
private districtRepo = AppDataSource.getRepository(District);
|
||||
private subDistrictRepo = AppDataSource.getRepository(SubDistrict);
|
||||
private profileInsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||
private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
|
||||
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
|
||||
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
|
||||
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
|
||||
private orgChild1Repository = AppDataSource.getRepository(OrgChild1);
|
||||
private viewCommanderDirectorRepository = AppDataSource.getRepository(viewCommanderDirector);
|
||||
|
||||
/**
|
||||
* report ประวัติแบบย่อ ข้าราชการ
|
||||
|
|
@ -2708,7 +2698,6 @@ export class ProfileController extends Controller {
|
|||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||
}
|
||||
let dateLeave_: any = body.date;
|
||||
let null_: any = null;
|
||||
profile.isLeave = false;
|
||||
profile.leaveReason = null_;
|
||||
|
|
@ -2781,7 +2770,6 @@ export class ProfileController extends Controller {
|
|||
@Body() body: UpdateProfileReqEdit,
|
||||
) {
|
||||
const record = await this.profileRepo.findOneBy({ id });
|
||||
const before = structuredClone(record);
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
|
|
@ -6781,7 +6769,6 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
const before = structuredClone(profile);
|
||||
const _null: any = null;
|
||||
profile.isLeave = requestBody.isLeave;
|
||||
profile.leaveReason = requestBody.leaveReason;
|
||||
profile.dateLeave = requestBody.dateLeave;
|
||||
|
|
@ -7237,31 +7224,6 @@ export class ProfileController extends Controller {
|
|||
.take(50)
|
||||
.getManyAndCount();
|
||||
|
||||
const profiles = await Promise.all(
|
||||
profile.map(async (_data) => {
|
||||
if (_data.current_holders.length == 0 && _data.next_holders.length == 0) {
|
||||
const salary = await this.salaryRepository.find({
|
||||
where: {
|
||||
profileId: _data.id,
|
||||
},
|
||||
});
|
||||
const insignia = await this.profileInsigniaRepo.find({
|
||||
where: {
|
||||
profileId: _data.id,
|
||||
},
|
||||
});
|
||||
const discipline = await this.profileDisciplineRepo.find({
|
||||
where: {
|
||||
profileId: _data.id,
|
||||
},
|
||||
});
|
||||
await this.salaryRepository.remove(salary);
|
||||
await this.profileInsigniaRepo.remove(insignia);
|
||||
await this.profileDisciplineRepo.remove(discipline);
|
||||
await this.profileRepo.remove(_data);
|
||||
}
|
||||
}),
|
||||
);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue