Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop
This commit is contained in:
commit
1277fcf19b
2 changed files with 360 additions and 36 deletions
72
.github/workflows/release.yaml
vendored
72
.github/workflows/release.yaml
vendored
|
|
@ -67,40 +67,40 @@ jobs:
|
||||||
docker compose pull
|
docker compose pull
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
# - name: Notify Discord Success
|
- name: Notify Discord Success
|
||||||
# if: success()
|
if: success()
|
||||||
# run: |
|
run: |
|
||||||
# curl -H "Content-Type: application/json" \
|
curl -H "Content-Type: application/json" \
|
||||||
# -X POST \
|
-X POST \
|
||||||
# -d '{
|
-d '{
|
||||||
# "embeds": [{
|
"embeds": [{
|
||||||
# "title": "✅ Deployment Success!",
|
"title": "✅ Deployment Success!",
|
||||||
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||||
# "color": 3066993,
|
"color": 3066993,
|
||||||
# "footer": {
|
"footer": {
|
||||||
# "text": "Release Notification",
|
"text": "Release Notification",
|
||||||
# "icon_url": "https://example.com/success-icon.png"
|
"icon_url": "https://example.com/success-icon.png"
|
||||||
# },
|
},
|
||||||
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
# }]
|
}]
|
||||||
# }' \
|
}' \
|
||||||
# ${{ secrets.DISCORD_WEBHOOK }}
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
# - name: Notify Discord Failure
|
- name: Notify Discord Failure
|
||||||
# if: failure()
|
if: failure()
|
||||||
# run: |
|
run: |
|
||||||
# curl -H "Content-Type: application/json" \
|
curl -H "Content-Type: application/json" \
|
||||||
# -X POST \
|
-X POST \
|
||||||
# -d '{
|
-d '{
|
||||||
# "embeds": [{
|
"embeds": [{
|
||||||
# "title": "❌ Deployment Failed!",
|
"title": "❌ Deployment Failed!",
|
||||||
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
|
||||||
# "color": 15158332,
|
"color": 15158332,
|
||||||
# "footer": {
|
"footer": {
|
||||||
# "text": "Release Notification",
|
"text": "Release Notification",
|
||||||
# "icon_url": "https://example.com/failure-icon.png"
|
"icon_url": "https://example.com/failure-icon.png"
|
||||||
# },
|
},
|
||||||
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
# }]
|
}]
|
||||||
# }' \
|
}' \
|
||||||
# ${{ secrets.DISCORD_WEBHOOK }}
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
|
||||||
|
|
@ -3386,6 +3386,177 @@ export class OrganizationDotnetController extends Controller {
|
||||||
return new HttpSuccess(profile_);
|
return new HttpSuccess(profile_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. เอารายชื่อคน ขรก. (none-validate-keycloak)
|
||||||
|
*
|
||||||
|
* @summary 5. เอารายชื่อคน ขรก. (none-validate-keycloak)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("none-validate-keycloak-all-officer")
|
||||||
|
async PostProfileWithNoneValidateKeycloakAllOfficer(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
node: number;
|
||||||
|
nodeId: string;
|
||||||
|
isAll: boolean;
|
||||||
|
isRetirement?: boolean;
|
||||||
|
revisionId?: string;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
let typeCondition: any = {};
|
||||||
|
if (body.isAll == false) {
|
||||||
|
if (body.node === 0) {
|
||||||
|
typeCondition = {
|
||||||
|
orgRootId: body.nodeId,
|
||||||
|
orgChild1Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 1) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild1Id: body.nodeId,
|
||||||
|
orgChild2Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 2) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild2Id: body.nodeId,
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 3) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild3Id: body.nodeId,
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 4) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4Id: body.nodeId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (body.node === 0) {
|
||||||
|
typeCondition = {
|
||||||
|
orgRootId: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 1) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild1Id: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 2) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild2Id: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 3) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild3Id: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 4) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4Id: body.nodeId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let profile = await this.profileRepo.find({
|
||||||
|
where: { isLeave: false, isRetirement: false, current_holders: typeCondition },
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
if (body.isRetirement) {
|
||||||
|
profile = await this.profileRepo.find({
|
||||||
|
where: {
|
||||||
|
isLeave: false,
|
||||||
|
current_holders: typeCondition,
|
||||||
|
isRetirement: true,
|
||||||
|
},
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
if(body.revisionId){
|
||||||
|
findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { id: body.revisionId },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const profile_ = await Promise.all(
|
||||||
|
profile.map((item: Profile) => {
|
||||||
|
const shortName =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||||
|
null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgChild3 != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgChild2 != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgChild1 != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||||
|
null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgRoot != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: null;
|
||||||
|
const Oc =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: body.node == 4 && item.current_holders[0].orgChild4 != null
|
||||||
|
? `${item.current_holders[0].orgChild4.orgChild4Name}/${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 3 && item.current_holders[0].orgChild3 != null
|
||||||
|
? `${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 2 && item.current_holders[0].orgChild2 != null
|
||||||
|
? `${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 1 && item.current_holders[0].orgChild1 != null
|
||||||
|
? `${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 0 && item.current_holders[0].orgRoot != null
|
||||||
|
? `${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: null;
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
prefix: item.prefix,
|
||||||
|
firstName: item.firstName,
|
||||||
|
lastName: item.lastName,
|
||||||
|
citizenId: item.citizenId,
|
||||||
|
keycloak: item.keycloak,
|
||||||
|
posNo: shortName,
|
||||||
|
position: item.position,
|
||||||
|
positionLevel: item.posLevel?.posLevelName ?? null,
|
||||||
|
positionType: item.posType?.posTypeName ?? null,
|
||||||
|
oc: Oc,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return new HttpSuccess(profile_);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
* 5. เอารายชื่อคนที่มีการ ,map keycloak id แล้ว
|
||||||
*
|
*
|
||||||
|
|
@ -3539,6 +3710,159 @@ export class OrganizationDotnetController extends Controller {
|
||||||
return new HttpSuccess(profile_);
|
return new HttpSuccess(profile_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. เอารายชื่อคน ลูกจ้างประจำ (none-validate-keycloak)
|
||||||
|
*
|
||||||
|
* @summary 5. เอารายชื่อคน ลูกจ้างประจำ (none-validate-keycloak)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("none-validate-keycloak-all-employee")
|
||||||
|
async PostProfileWithNoneValidateKeycloakAllEmployee(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
node: number;
|
||||||
|
nodeId: string;
|
||||||
|
isAll: boolean;
|
||||||
|
revisionId?: string;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
let typeCondition: any = {};
|
||||||
|
if (body.isAll == false) {
|
||||||
|
if (body.node === 0) {
|
||||||
|
typeCondition = {
|
||||||
|
orgRootId: body.nodeId,
|
||||||
|
orgChild1Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 1) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild1Id: body.nodeId,
|
||||||
|
orgChild2Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 2) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild2Id: body.nodeId,
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 3) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild3Id: body.nodeId,
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
};
|
||||||
|
} else if (body.node === 4) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4Id: body.nodeId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (body.node === 0) {
|
||||||
|
typeCondition = {
|
||||||
|
orgRootId: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 1) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild1Id: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 2) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild2Id: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 3) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild3Id: body.nodeId,
|
||||||
|
};
|
||||||
|
} else if (body.node === 4) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4Id: body.nodeId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const profile = await this.profileEmpRepo.find({
|
||||||
|
where: { isLeave: false, isRetirement: false, current_holders: typeCondition },
|
||||||
|
relations: [
|
||||||
|
"posType",
|
||||||
|
"posLevel",
|
||||||
|
"current_holders",
|
||||||
|
"current_holders.orgRoot",
|
||||||
|
"current_holders.orgChild1",
|
||||||
|
"current_holders.orgChild2",
|
||||||
|
"current_holders.orgChild3",
|
||||||
|
"current_holders.orgChild4",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
let findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
if(body.revisionId){
|
||||||
|
findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { id: body.revisionId },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const profile_ = await Promise.all(
|
||||||
|
profile.map((item: ProfileEmployee) => {
|
||||||
|
const shortName =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4 !=
|
||||||
|
null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgChild3 != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgChild2 != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild2.orgChild2ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgChild1 != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild1.orgChild1ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) !=
|
||||||
|
null &&
|
||||||
|
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
|
||||||
|
?.orgRoot != null
|
||||||
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
|
: null;
|
||||||
|
const Oc =
|
||||||
|
item.current_holders.length == 0
|
||||||
|
? null
|
||||||
|
: body.node == 4 && item.current_holders[0].orgChild4 != null
|
||||||
|
? `${item.current_holders[0].orgChild4.orgChild4Name}/${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 3 && item.current_holders[0].orgChild3 != null
|
||||||
|
? `${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 2 && item.current_holders[0].orgChild2 != null
|
||||||
|
? `${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 1 && item.current_holders[0].orgChild1 != null
|
||||||
|
? `${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: body.node == 0 && item.current_holders[0].orgRoot != null
|
||||||
|
? `${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
|
: null;
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
prefix: item.prefix,
|
||||||
|
firstName: item.firstName,
|
||||||
|
lastName: item.lastName,
|
||||||
|
citizenId: item.citizenId,
|
||||||
|
keycloak: item.keycloak,
|
||||||
|
posNo: shortName,
|
||||||
|
position: item.position,
|
||||||
|
positionLevel: item.posLevel
|
||||||
|
? `${item.posType.posTypeShortName} ${item.posLevel.posLevelName}`
|
||||||
|
: "-",
|
||||||
|
positionType: item.posType?.posTypeName ?? null,
|
||||||
|
oc: Oc,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return new HttpSuccess(profile_);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4. API Update รอบการลงเวลา ในตาราง profile
|
* 4. API Update รอบการลงเวลา ในตาราง profile
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue