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;
|
||||
})
|
||||
.catch(async (x) => {
|
||||
throw new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง4");
|
||||
throw new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง");
|
||||
}),
|
||||
]);
|
||||
if (_data == null) {
|
||||
return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง5");
|
||||
return new HttpError(HttpStatus.UNAUTHORIZED, "ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง");
|
||||
} else {
|
||||
return new HttpSuccess(_data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -548,6 +548,36 @@ export class OrganizationDotnetController extends Controller {
|
|||
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||
)?.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,
|
||||
posLevel: profile.posLevel?.posLevelName ?? null,
|
||||
posType: profile.posType?.posTypeName ?? null,
|
||||
|
|
@ -785,6 +815,36 @@ export class OrganizationDotnetController extends Controller {
|
|||
x.orgRevision?.orgRevisionIsDraft == false &&
|
||||
x.orgRevision?.orgRevisionIsCurrent == true,
|
||||
)?.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,
|
||||
posLevel: profile.posLevel?.posLevelName ?? null,
|
||||
posType: profile.posType?.posTypeName ?? null,
|
||||
|
|
|
|||
|
|
@ -562,270 +562,274 @@ export class PositionController extends Controller {
|
|||
@Get("position")
|
||||
async findPosition(@Query("keyword") keyword?: string, @Query("type") type?: string) {
|
||||
let findPosDict: any;
|
||||
if(keyword && keyword?.length > 0){
|
||||
switch (type) {
|
||||
case "positionName":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
if (keyword && keyword?.length > 0) {
|
||||
switch (type) {
|
||||
case "positionName":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionField":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictField: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictField: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
case "positionField":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictField: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictField: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionType":
|
||||
const findTypes: PosType[] = await this.posTypeRepository.find({
|
||||
where: { posTypeName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
order: {
|
||||
// posTypeName: "ASC"
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posTypeId: In(findTypes.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
case "positionType":
|
||||
const findTypes: PosType[] = await this.posTypeRepository.find({
|
||||
where: { posTypeName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||
order: {
|
||||
// posTypeName: "ASC"
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posTypeId: In(findTypes.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionLevel":
|
||||
const findLevel: PosLevel[] = await this.posLevelRepository.find({
|
||||
where: { posLevelName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
order: {
|
||||
// posLevelName: "ASC"
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posLevelId: In(findLevel.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
case "positionLevel":
|
||||
const findLevel: PosLevel[] = await this.posLevelRepository.find({
|
||||
where: { posLevelName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||
order: {
|
||||
// posLevelName: "ASC"
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posLevelId: In(findLevel.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionExecutive":
|
||||
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
|
||||
where: { posExecutiveName: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posExecutiveId: In(findExecutive.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
case "positionExecutive":
|
||||
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
|
||||
where: {
|
||||
posExecutiveName: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
select: ["id"],
|
||||
});
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posExecutiveId: In(findExecutive.map((x) => x.id)) },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionExecutiveField":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictExecutiveField: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
case "positionExecutiveField":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: {
|
||||
posDictExecutiveField: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
case "positionArea":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictArea: keyword && keyword.length > 0?Like(`%${keyword}%`):"1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
case "positionArea":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: { posDictArea: keyword && keyword.length > 0 ? Like(`%${keyword}%`) : "1=1" },
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
case "ALL":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: [
|
||||
{ posDictName: Like(`%${keyword}%`) },
|
||||
{ posDictField: Like(`%${keyword}%`) },
|
||||
{
|
||||
posTypeId: In(
|
||||
await this.posTypeRepository
|
||||
.find({ where: { posTypeName: Like(`%${keyword}%`) }, select: ["id"] })
|
||||
.then((types) => types.map((type) => type.id)),
|
||||
),
|
||||
case "ALL":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: [
|
||||
{ posDictName: Like(`%${keyword}%`) },
|
||||
{ posDictField: Like(`%${keyword}%`) },
|
||||
{
|
||||
posTypeId: In(
|
||||
await this.posTypeRepository
|
||||
.find({ where: { posTypeName: Like(`%${keyword}%`) }, select: ["id"] })
|
||||
.then((types) => types.map((type) => type.id)),
|
||||
),
|
||||
},
|
||||
{
|
||||
posLevelId: In(
|
||||
await this.posLevelRepository
|
||||
.find({ where: { posLevelName: Like(`%${keyword}%`) }, select: ["id"] })
|
||||
.then((levels) => levels.map((level) => level.id)),
|
||||
),
|
||||
},
|
||||
{
|
||||
posExecutiveId: In(
|
||||
await this.posExecutiveRepository
|
||||
.find({ where: { posExecutiveName: Like(`%${keyword}%`) }, select: ["id"] })
|
||||
.then((executives) => executives.map((exec) => exec.id)),
|
||||
),
|
||||
},
|
||||
{ posDictExecutiveField: Like(`%${keyword}%`) },
|
||||
{ posDictArea: Like(`%${keyword}%`) },
|
||||
],
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
{
|
||||
posLevelId: In(
|
||||
await this.posLevelRepository
|
||||
.find({ where: { posLevelName: Like(`%${keyword}%`) }, select: ["id"] })
|
||||
.then((levels) => levels.map((level) => level.id)),
|
||||
),
|
||||
},
|
||||
{
|
||||
posExecutiveId: In(
|
||||
await this.posExecutiveRepository
|
||||
.find({ where: { posExecutiveName: Like(`%${keyword}%`) }, select: ["id"] })
|
||||
.then((executives) => executives.map((exec) => exec.id)),
|
||||
),
|
||||
},
|
||||
{ posDictExecutiveField: Like(`%${keyword}%`) },
|
||||
{ posDictArea: Like(`%${keyword}%`) },
|
||||
],
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
default:
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
},
|
||||
});
|
||||
break;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType:{
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC"
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posExecutive: {
|
||||
posExecutivePriority: "ASC"
|
||||
}
|
||||
posExecutivePriority: "ASC",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -4970,53 +4974,53 @@ export class PositionController extends Controller {
|
|||
.where(conditions)
|
||||
.andWhere(
|
||||
_data.root != undefined && _data.root != null
|
||||
? _data.root[0] != null
|
||||
? `posMaster.orgRootId IN (:...root)`
|
||||
: `posMaster.orgRootId is null`
|
||||
: "1=1",
|
||||
{
|
||||
root: _data.root,
|
||||
},
|
||||
? _data.root[0] != null
|
||||
? `posMaster.orgRootId IN (:...root)`
|
||||
: `posMaster.orgRootId is null`
|
||||
: "1=1",
|
||||
{
|
||||
root: _data.root,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `posMaster.orgChild1Id IN (:...child1)`
|
||||
: `posMaster.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
},
|
||||
? _data.child1[0] != null
|
||||
? `posMaster.orgChild1Id IN (:...child1)`
|
||||
: `posMaster.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
_data.child2 != undefined && _data.child2 != null
|
||||
? _data.child2[0] != null
|
||||
? `posMaster.orgChild2Id IN (:...child2)`
|
||||
: `posMaster.orgChild2Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child2: _data.child2,
|
||||
},
|
||||
? _data.child2[0] != null
|
||||
? `posMaster.orgChild2Id IN (:...child2)`
|
||||
: `posMaster.orgChild2Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child2: _data.child2,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
_data.child3 != undefined && _data.child3 != null
|
||||
? _data.child3[0] != null
|
||||
? `posMaster.orgChild3Id IN (:...child3)`
|
||||
: `posMaster.orgChild3Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child3: _data.child3,
|
||||
},
|
||||
? _data.child3[0] != null
|
||||
? `posMaster.orgChild3Id IN (:...child3)`
|
||||
: `posMaster.orgChild3Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child3: _data.child3,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
_data.child4 != undefined && _data.child4 != null
|
||||
? _data.child4[0] != null
|
||||
? `posMaster.orgChild4Id IN (:...child4)`
|
||||
: `posMaster.orgChild4Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child4: _data.child4,
|
||||
},
|
||||
? _data.child4[0] != null
|
||||
? `posMaster.orgChild4Id IN (:...child4)`
|
||||
: `posMaster.orgChild4Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child4: _data.child4,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
|
|
@ -5027,10 +5031,10 @@ export class PositionController extends Controller {
|
|||
: `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)
|
||||
.andWhere({ current_holderId: IsNull() });
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition)
|
||||
.andWhere({ current_holderId: IsNull() });
|
||||
}),
|
||||
)
|
||||
.orderBy("posMaster.posMasterOrder", "ASC")
|
||||
|
|
@ -5075,7 +5079,8 @@ export class PositionController extends Controller {
|
|||
},
|
||||
relations: ["posLevel", "posType", "posExecutive"],
|
||||
order: {
|
||||
createdAt: "ASC",
|
||||
posType: { posTypeRank: "ASC" },
|
||||
posLevel: { posLevelRank: "ASC" },
|
||||
},
|
||||
});
|
||||
let shortName = "";
|
||||
|
|
|
|||
|
|
@ -2007,9 +2007,7 @@ export class ProfileController extends Controller {
|
|||
process.env.AUTH_ACCOUNT_SECRET,
|
||||
{ expiresIn: "15m" },
|
||||
);
|
||||
// console.log("[token]",token);
|
||||
const link = process.env.URL + "/verifyemail?upn=" + token;
|
||||
// console.log("[link]",link);
|
||||
|
||||
await new CallAPI()
|
||||
.PostData(req, "/placement/noti/send-mail", {
|
||||
|
|
@ -3964,6 +3962,28 @@ export class ProfileController extends Controller {
|
|||
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 รายละเอียดรายการทะเบียนประวัติ
|
||||
*
|
||||
|
|
@ -8274,7 +8294,6 @@ export class ProfileController extends Controller {
|
|||
receiverUserId: x.id,
|
||||
notiLink: "",
|
||||
}));
|
||||
console.log(profileNoti);
|
||||
await new CallAPI()
|
||||
.PostData(req, "/placement/noti/profiles", {
|
||||
subject: body.subject,
|
||||
|
|
|
|||
|
|
@ -1309,6 +1309,28 @@ export class ProfileEmployeeController extends Controller {
|
|||
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 รายละเอียดรายการทะเบียนประวัติ
|
||||
*
|
||||
|
|
|
|||
|
|
@ -107,6 +107,14 @@ export class KeycloakController extends Controller {
|
|||
}
|
||||
const list = await getRoles();
|
||||
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({
|
||||
where: {
|
||||
id: body.profileId,
|
||||
|
|
|
|||
|
|
@ -817,7 +817,7 @@ export class WorkflowController extends Controller {
|
|||
orgRootId: posMasterUser.orgRootId,
|
||||
};
|
||||
|
||||
if (type.trim().toLowerCase() == "OPERATE") {
|
||||
if (type.trim().toUpperCase() == "OPERATE") {
|
||||
} else {
|
||||
if (
|
||||
(posMasterUser.current_holder.posType.posTypeName == "ทั่วไป" &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue