api update profile amount
This commit is contained in:
parent
2f5aef96f3
commit
0c7c3361f6
3 changed files with 319 additions and 273 deletions
|
|
@ -562,59 +562,59 @@ export class PositionController extends Controller {
|
||||||
@Get("position")
|
@Get("position")
|
||||||
async findPosition(@Query("keyword") keyword?: string, @Query("type") type?: string) {
|
async findPosition(@Query("keyword") keyword?: string, @Query("type") type?: string) {
|
||||||
let findPosDict: any;
|
let findPosDict: any;
|
||||||
if(keyword && keyword?.length > 0){
|
if (keyword && keyword?.length > 0) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "positionName":
|
case "positionName":
|
||||||
findPosDict = await this.posDictRepository.find({
|
findPosDict = await this.posDictRepository.find({
|
||||||
where: { posDictName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: { posDictName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||||
relations: ["posType", "posLevel", "posExecutive"],
|
relations: ["posType", "posLevel", "posExecutive"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionField":
|
case "positionField":
|
||||||
findPosDict = await this.posDictRepository.find({
|
findPosDict = await this.posDictRepository.find({
|
||||||
where: { posDictField: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: { posDictField: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||||
relations: ["posType", "posLevel", "posExecutive"],
|
relations: ["posType", "posLevel", "posExecutive"],
|
||||||
order: {
|
order: {
|
||||||
posDictField: "ASC",
|
posDictField: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionType":
|
case "positionType":
|
||||||
const findTypes: PosType[] = await this.posTypeRepository.find({
|
const findTypes: PosType[] = await this.posTypeRepository.find({
|
||||||
where: { posTypeName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: { posTypeName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||||
order: {
|
order: {
|
||||||
// posTypeName: "ASC"
|
// posTypeName: "ASC"
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
select: ["id"],
|
select: ["id"],
|
||||||
});
|
});
|
||||||
|
|
@ -624,28 +624,28 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionLevel":
|
case "positionLevel":
|
||||||
const findLevel: PosLevel[] = await this.posLevelRepository.find({
|
const findLevel: PosLevel[] = await this.posLevelRepository.find({
|
||||||
where: { posLevelName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: { posLevelName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||||
order: {
|
order: {
|
||||||
// posLevelName: "ASC"
|
// posLevelName: "ASC"
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
select: ["id"],
|
select: ["id"],
|
||||||
});
|
});
|
||||||
|
|
@ -655,24 +655,26 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionExecutive":
|
case "positionExecutive":
|
||||||
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
|
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
|
||||||
where: { posExecutiveName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: {
|
||||||
|
posExecutiveName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1",
|
||||||
|
},
|
||||||
select: ["id"],
|
select: ["id"],
|
||||||
});
|
});
|
||||||
findPosDict = await this.posDictRepository.find({
|
findPosDict = await this.posDictRepository.find({
|
||||||
|
|
@ -681,61 +683,63 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionExecutiveField":
|
case "positionExecutiveField":
|
||||||
findPosDict = await this.posDictRepository.find({
|
findPosDict = await this.posDictRepository.find({
|
||||||
where: { posDictExecutiveField: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: {
|
||||||
|
posDictExecutiveField: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1",
|
||||||
|
},
|
||||||
relations: ["posType", "posLevel", "posExecutive"],
|
relations: ["posType", "posLevel", "posExecutive"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionArea":
|
case "positionArea":
|
||||||
findPosDict = await this.posDictRepository.find({
|
findPosDict = await this.posDictRepository.find({
|
||||||
where: { posDictArea: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
where: { posDictArea: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||||
relations: ["posType", "posLevel", "posExecutive"],
|
relations: ["posType", "posLevel", "posExecutive"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
@ -773,17 +777,17 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
@ -794,38 +798,38 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
findPosDict = await this.posDictRepository.find({
|
findPosDict = await this.posDictRepository.find({
|
||||||
relations: ["posType", "posLevel", "posExecutive"],
|
relations: ["posType", "posLevel", "posExecutive"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
createdAt: "DESC",
|
createdAt: "DESC",
|
||||||
posType:{
|
posType: {
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posLevel: {
|
posLevel: {
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
posExecutive: {
|
posExecutive: {
|
||||||
posExecutivePriority: "ASC"
|
posExecutivePriority: "ASC",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -5075,7 +5079,8 @@ export class PositionController extends Controller {
|
||||||
},
|
},
|
||||||
relations: ["posLevel", "posType", "posExecutive"],
|
relations: ["posLevel", "posType", "posExecutive"],
|
||||||
order: {
|
order: {
|
||||||
createdAt: "ASC",
|
posType: { posTypeRank: "ASC" },
|
||||||
|
posLevel: { posLevelRank: "ASC" },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
let shortName = "";
|
let shortName = "";
|
||||||
|
|
|
||||||
|
|
@ -2007,9 +2007,7 @@ export class ProfileController extends Controller {
|
||||||
process.env.AUTH_ACCOUNT_SECRET,
|
process.env.AUTH_ACCOUNT_SECRET,
|
||||||
{ expiresIn: "15m" },
|
{ expiresIn: "15m" },
|
||||||
);
|
);
|
||||||
// console.log("[token]",token);
|
|
||||||
const link = process.env.URL + "/verifyemail?upn=" + token;
|
const link = process.env.URL + "/verifyemail?upn=" + token;
|
||||||
// console.log("[link]",link);
|
|
||||||
|
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(req, "/placement/noti/send-mail", {
|
.PostData(req, "/placement/noti/send-mail", {
|
||||||
|
|
@ -3964,6 +3962,28 @@ export class ProfileController extends Controller {
|
||||||
return new HttpSuccess({ data: data, total });
|
return new HttpSuccess({ data: data, total });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API Update amount
|
||||||
|
*
|
||||||
|
* @summary Update amount (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("update-amount")
|
||||||
|
async updateProfileAmount(@Request() request: RequestWithUser) {
|
||||||
|
const profiles = await this.profileRepo.find({
|
||||||
|
order: { profileSalary: { order: "DESC" } },
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
});
|
||||||
|
profiles.map(async (x) => {
|
||||||
|
const amount = x.profileSalary[0];
|
||||||
|
x.amount = amount?.amount ?? 0;
|
||||||
|
x.amountSpecial = amount?.amountSpecial ?? 0;
|
||||||
|
x.positionSalaryAmount = amount?.positionSalaryAmount ?? 0;
|
||||||
|
await this.profileRepo.save(x);
|
||||||
|
});
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายละเอียดรายการทะเบียนประวัติ
|
* API รายละเอียดรายการทะเบียนประวัติ
|
||||||
*
|
*
|
||||||
|
|
@ -8274,7 +8294,6 @@ export class ProfileController extends Controller {
|
||||||
receiverUserId: x.id,
|
receiverUserId: x.id,
|
||||||
notiLink: "",
|
notiLink: "",
|
||||||
}));
|
}));
|
||||||
console.log(profileNoti);
|
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(req, "/placement/noti/profiles", {
|
.PostData(req, "/placement/noti/profiles", {
|
||||||
subject: body.subject,
|
subject: body.subject,
|
||||||
|
|
|
||||||
|
|
@ -1309,6 +1309,28 @@ export class ProfileEmployeeController extends Controller {
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API Update amount
|
||||||
|
*
|
||||||
|
* @summary Update amount (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("update-amount")
|
||||||
|
async updateProfileAmount(@Request() request: RequestWithUser) {
|
||||||
|
const profiles = await this.profileRepo.find({
|
||||||
|
order: { profileSalary: { order: "DESC" } },
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
});
|
||||||
|
profiles.map(async (x) => {
|
||||||
|
const amount = x.profileSalary[0];
|
||||||
|
x.amount = amount?.amount ?? 0;
|
||||||
|
x.amountSpecial = amount?.amountSpecial ?? 0;
|
||||||
|
x.positionSalaryAmount = amount?.positionSalaryAmount ?? 0;
|
||||||
|
await this.profileRepo.save(x);
|
||||||
|
});
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายละเอียดรายการทะเบียนประวัติ
|
* API รายละเอียดรายการทะเบียนประวัติ
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue