checkpoint,แก้ไขชื่อฟิว

This commit is contained in:
AdisakKanthawilang 2024-11-20 14:02:01 +07:00
parent 8eae807a64
commit 9dac11934b
5 changed files with 243 additions and 47 deletions

View file

@ -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;

View file

@ -1873,6 +1873,72 @@ 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.profileId
}
});
await new CallAPI()
.PostData(req, "/profile/gen-link-verify-email", {
body: body.email,
})
.catch((error) => {
console.error("Error calling API:", error);
});
// 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;
},
) {
// var uuid = require('node-uuid');
// var timeBasedID = uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
// var randomID = uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
// var url = 'www.privatebox.de/' + randomID; // or + timeBasedID
var jwt = require('jsonwebtoken');
var token = jwt.sign({email_id: body.email}, "Stack", {expiresIn: '24h'});
console.log("[token]",token);
}
/**
* API
*
@ -7904,7 +7970,7 @@ export class ProfileController extends Controller {
Object.assign(profile, body);
Object.assign(history, { ...profile, id: undefined });
profile.statusEmail = "NOT_VERIFIED";
profile.emailVerify = "NOT_VERIFIED";
profile.lastUpdateUserId = request.user.sub;
profile.lastUpdateFullName = request.user.name;
profile.lastUpdatedAt = new Date();