api update isdirector

This commit is contained in:
kittapath 2025-03-14 13:36:26 +07:00
parent c02a45630a
commit cd419686b0

View file

@ -2481,7 +2481,6 @@ export class ImportDataController extends Controller {
.createQueryBuilder("profile")
.select(["profile.citizenId", "profile.id"])
.orderBy("profile.citizenId", "ASC")
.where("profile.citizenId = '3101501190150'")
// .skip(0)
// .take(1000)
.getManyAndCount();
@ -2498,9 +2497,7 @@ export class ImportDataController extends Controller {
});
// await Promise.all(
// profiles.map(async (_item) => {
console.log("XXXXXXXXXXXXXXX");
for await (const _item of profiles) {
console.log("zzzzzzzzzzzzz");
const existingProfile = await this.ProfileSalariesRepo.find({
where: { posNo: _item.citizenId },
order: {
@ -2511,7 +2508,6 @@ export class ImportDataController extends Controller {
// await Promise.all(
// existingProfile.map(async (item) => {
for await (const item of existingProfile) {
console.log("zzzzzzz4zzzzzz");
rowCount++;
const profileSalary: any = new ProfileSalary();
profileSalary.profileId = _item.id;
@ -2540,7 +2536,6 @@ export class ImportDataController extends Controller {
profileSalary.positionCee = this.canConvertToInt(item.PositionLevelName)
? item.PositionLevelName
: _null;
//xxxxxxxxxxxxxxxxx
profileSalary.positionType = item.PositionTypeName;
profileSalary.isEntry = true;
@ -2577,4 +2572,23 @@ export class ImportDataController extends Controller {
return null;
}
}
/**
* @summary
*/
@Post("mark-director")
async UpdateMarkDirector(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
const posMaster = await this.posMasterRepo.find({
where: { positions: { posExecutiveId: Not(IsNull()) } },
});
for await (const _item of posMaster) {
rowCount++;
_item.isDirector = true;
await this.posMasterRepo.save(_item);
console.log(rowCount);
}
return new HttpSuccess();
}
}