Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
This commit is contained in:
commit
dc6e157ffe
4 changed files with 238 additions and 45 deletions
|
|
@ -1348,60 +1348,103 @@ export class PositionController extends Controller {
|
|||
.leftJoinAndSelect("posMaster.orgRevision", "orgRevision")
|
||||
.leftJoinAndSelect("posMaster.posMasterAssigns", "posMasterAssigns")
|
||||
.leftJoinAndSelect("posMasterAssigns.assign", "assign")
|
||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.where(conditions)
|
||||
.andWhere(
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? body.isAll == false
|
||||
? searchShortName
|
||||
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? body.isAll == false
|
||||
? searchShortName
|
||||
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
);
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `CONCAT(current_holder.prefix, current_holder.firstName," ",current_holder.lastName) like '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `CASE WHEN orgRevision.orgRevisionIsDraft = true THEN CONCAT(next_holder.prefix, next_holder.firstName,' ', next_holder.lastName) ELSE CONCAT(current_holder.prefix, current_holder.firstName,' ' , current_holder.lastName) END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `current_holder.posType LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `current_holder.posLevel LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
})
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `current_holder.position LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
})
|
||||
)
|
||||
.orderBy("posMaster.posMasterOrder", "ASC")
|
||||
.skip((body.page - 1) * body.pageSize)
|
||||
.take(body.pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
|
||||
//แก้ค้นหา
|
||||
let _position: any[] = [];
|
||||
let x: any = null;
|
||||
|
|
|
|||
|
|
@ -1873,6 +1873,69 @@ export class ProfileController extends Controller {
|
|||
return new HttpSuccess(profile.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ส่งลิงค์ยืนยัน Email
|
||||
*
|
||||
* @summary ส่งลิงค์ยืนยัน Email
|
||||
*
|
||||
*/
|
||||
@Post("send-verify-email")
|
||||
async sendVerifyEmail(
|
||||
@Request() req:RequestWithUser,
|
||||
@Body()
|
||||
body: {
|
||||
profileId: string;
|
||||
email: string;
|
||||
subject: string;
|
||||
}
|
||||
) {
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where:{
|
||||
id: body.profileId,
|
||||
email: body.email
|
||||
}
|
||||
});
|
||||
|
||||
const jwt = require('jsonwebtoken');
|
||||
const token = jwt.sign({email_id: body.email}, "Stack", {expiresIn: '24h'});
|
||||
console.log("[token]",token);
|
||||
const link = process.env.API_URL + "/" + token;
|
||||
|
||||
const detail = null;
|
||||
await new CallAPI()
|
||||
.PostData(req, "/placement/notisend-mail", {
|
||||
subject: body.subject,
|
||||
body: detail,
|
||||
Email: body.email,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error calling API:", error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API ยืนยัน Email
|
||||
*
|
||||
* @summary ยืนยัน Email
|
||||
*
|
||||
*/
|
||||
@Post("gen-link-verify-email")
|
||||
async genLinkVerifyEmail(
|
||||
@Request() req:RequestWithUser,
|
||||
@Body() body:{
|
||||
email: string;
|
||||
},
|
||||
) {
|
||||
// const profile = await this.profileRepo.findOne({
|
||||
// where:{
|
||||
// id: body.profileId,
|
||||
// email: body.email
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API ออกคำสั่ง คำสั่งให้ข้าราชการที่มีผลการทดลองปฏิบัติหน้าที่ราชการไม่ต่ำกว่ามาตรฐานที่กำหนดรับราชการต่อไป
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue