Merge branch 'develop' into adiDev
This commit is contained in:
commit
168a5ec53c
7 changed files with 390 additions and 276 deletions
|
|
@ -42,11 +42,11 @@ export class LoginController extends Controller {
|
||||||
_data = x;
|
_data = x;
|
||||||
})
|
})
|
||||||
.catch(async (x) => {
|
.catch(async (x) => {
|
||||||
throw new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง4");
|
throw new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง");
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
if (_data == null) {
|
if (_data == null) {
|
||||||
return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง5");
|
return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง");
|
||||||
} else {
|
} else {
|
||||||
return new HttpSuccess(_data);
|
return new HttpSuccess(_data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -548,6 +548,36 @@ export class OrganizationDotnetController extends Controller {
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild4?.orgChild4Name ?? null,
|
)?.orgChild4?.orgChild4Name ?? null,
|
||||||
|
rootId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgRootId ?? null,
|
||||||
|
child1Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild1Id ?? null,
|
||||||
|
child2Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild2Id ?? null,
|
||||||
|
child3Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild3Id ?? null,
|
||||||
|
child4Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild4Id ?? null,
|
||||||
commander: fullname,
|
commander: fullname,
|
||||||
posLevel: profile.posLevel?.posLevelName ?? null,
|
posLevel: profile.posLevel?.posLevelName ?? null,
|
||||||
posType: profile.posType?.posTypeName ?? null,
|
posType: profile.posType?.posTypeName ?? null,
|
||||||
|
|
@ -785,6 +815,36 @@ export class OrganizationDotnetController extends Controller {
|
||||||
x.orgRevision?.orgRevisionIsDraft == false &&
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
)?.orgChild4?.orgChild4Name ?? null,
|
)?.orgChild4?.orgChild4Name ?? null,
|
||||||
|
rootId:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgRootId ?? null,
|
||||||
|
child1Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild1Id ?? null,
|
||||||
|
child2Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild2Id ?? null,
|
||||||
|
child3Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild3Id ?? null,
|
||||||
|
child4Id:
|
||||||
|
profile?.current_holders?.find(
|
||||||
|
(x) =>
|
||||||
|
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||||
|
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||||
|
)?.orgChild4Id ?? null,
|
||||||
commander: fullname,
|
commander: fullname,
|
||||||
posLevel: profile.posLevel?.posLevelName ?? null,
|
posLevel: profile.posLevel?.posLevelName ?? null,
|
||||||
posType: profile.posType?.posTypeName ?? null,
|
posType: profile.posType?.posTypeName ?? null,
|
||||||
|
|
|
||||||
|
|
@ -573,15 +573,15 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -595,15 +595,15 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -614,7 +614,7 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
// posTypeName: "ASC"
|
// posTypeName: "ASC"
|
||||||
posTypeRank: "ASC",
|
posTypeRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
select: ["id"],
|
select: ["id"],
|
||||||
});
|
});
|
||||||
|
|
@ -626,15 +626,15 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -645,7 +645,7 @@ export class PositionController extends Controller {
|
||||||
order: {
|
order: {
|
||||||
// posLevelName: "ASC"
|
// posLevelName: "ASC"
|
||||||
posLevelRank: "ASC",
|
posLevelRank: "ASC",
|
||||||
createdAt: "DESC"
|
createdAt: "DESC",
|
||||||
},
|
},
|
||||||
select: ["id"],
|
select: ["id"],
|
||||||
});
|
});
|
||||||
|
|
@ -657,22 +657,24 @@ export class PositionController extends Controller {
|
||||||
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({
|
||||||
|
|
@ -683,37 +685,39 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -727,15 +731,15 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -775,15 +779,15 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -796,15 +800,15 @@ export class PositionController extends Controller {
|
||||||
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;
|
||||||
|
|
@ -817,15 +821,15 @@ export class PositionController extends Controller {
|
||||||
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 รายละเอียดรายการทะเบียนประวัติ
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,14 @@ export class KeycloakController extends Controller {
|
||||||
}
|
}
|
||||||
const list = await getRoles();
|
const list = await getRoles();
|
||||||
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
||||||
|
const result = await addUserRoles(
|
||||||
|
userId,
|
||||||
|
list.filter((v) => body.roles.includes(v.id)),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
throw new Error("Failed. Cannot set user's role.");
|
||||||
|
}
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: body.profileId,
|
id: body.profileId,
|
||||||
|
|
|
||||||
|
|
@ -817,7 +817,7 @@ export class WorkflowController extends Controller {
|
||||||
orgRootId: posMasterUser.orgRootId,
|
orgRootId: posMasterUser.orgRootId,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type.trim().toLowerCase() == "OPERATE") {
|
if (type.trim().toUpperCase() == "OPERATE") {
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
(posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" &&
|
(posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue