ส่งตัวกลับ

This commit is contained in:
mamoss 2025-03-28 23:47:02 +07:00
parent a34f814eba
commit 971ff7712f
4 changed files with 1322 additions and 54 deletions

View file

@ -67,40 +67,40 @@ jobs:
docker compose pull
docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- name: Notify Discord Success
if: success()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "✅ Deployment Success!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
"color": 3066993,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
# - name: Notify Discord Success
# if: success()
# run: |
# curl -H "Content-Type: application/json" \
# -X POST \
# -d '{
# "embeds": [{
# "title": "✅ Deployment Success!",
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
# "color": 3066993,
# "footer": {
# "text": "Release Notification",
# "icon_url": "https://example.com/success-icon.png"
# },
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
# }]
# }' \
# ${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Discord Failure
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "❌ Deployment Failed!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
"color": 15158332,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/failure-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
# - name: Notify Discord Failure
# if: failure()
# run: |
# curl -H "Content-Type: application/json" \
# -X POST \
# -d '{
# "embeds": [{
# "title": "❌ Deployment Failed!",
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
# "color": 15158332,
# "footer": {
# "text": "Release Notification",
# "icon_url": "https://example.com/failure-icon.png"
# },
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
# }]
# }' \
# ${{ secrets.DISCORD_WEBHOOK }}

View file

@ -2599,7 +2599,7 @@ export class CommandController extends Controller {
},
@Request() request: RequestWithUser,
) {
let _null:any = null;
let _null: any = null;
let _data = new Array();
const _posMasterCommission = await this.posMasterRepository.findOne({
where: {
@ -2614,17 +2614,17 @@ export class CommandController extends Controller {
relations: ["current_holder", "orgRoot", "positions"],
order: { posMasterOrder: "ASC" },
});
if(_posMasterCommission) {
if (_posMasterCommission) {
_data.push({
citizenId: _posMasterCommission?.current_holder.citizenId ?? _null,
prefix: _posMasterCommission?.current_holder.prefix,
firstName: _posMasterCommission?.current_holder.firstName,
lastName: _posMasterCommission?.current_holder.lastName,
organizationName: _posMasterCommission.orgRoot
organizationName: _posMasterCommission.orgRoot
? _posMasterCommission.orgRoot.orgRootName
: _null,
positionName: _posMasterCommission?.current_holder.position ?? _null,
profileId: _posMasterCommission?.current_holder.id ?? _null
profileId: _posMasterCommission?.current_holder.id ?? _null,
});
}
@ -2641,17 +2641,15 @@ export class CommandController extends Controller {
relations: ["current_holder", "orgRoot", "positions"],
order: { posMasterOrder: "ASC" },
});
if(_posMasterOfficer) {
if (_posMasterOfficer) {
_data.push({
citizenId: _posMasterOfficer?.current_holder.citizenId ?? _null,
prefix: _posMasterOfficer?.current_holder.prefix,
firstName: _posMasterOfficer?.current_holder.firstName,
lastName: _posMasterOfficer?.current_holder.lastName,
organizationName: _posMasterOfficer.orgRoot
? _posMasterOfficer.orgRoot.orgRootName
: _null,
organizationName: _posMasterOfficer.orgRoot ? _posMasterOfficer.orgRoot.orgRootName : _null,
positionName: _posMasterOfficer?.current_holder.position ?? _null,
profileId: _posMasterOfficer?.current_holder.id ?? _null
profileId: _posMasterOfficer?.current_holder.id ?? _null,
});
}
@ -2705,7 +2703,7 @@ export class CommandController extends Controller {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
isDirector: true,
current_holderId: Not(IsNull()),
id: Not(In([_posMasterCommission?.id]))
id: Not(In([_posMasterCommission?.id])),
},
{
orgChild1: In(_orgChild1),
@ -2715,7 +2713,7 @@ export class CommandController extends Controller {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
isDirector: true,
current_holderId: Not(IsNull()),
id: Not(In([_posMasterOfficer?.id]))
id: Not(In([_posMasterOfficer?.id])),
},
{
orgChild2: In(_orgChild2),
@ -2742,7 +2740,7 @@ export class CommandController extends Controller {
relations: ["current_holder", "orgRoot"],
});
if (_posMaster.length > 0) {
_posMaster.forEach((x:any) => {
_posMaster.forEach((x: any) => {
_data.push({
citizenId: x?.current_holder.citizenId ?? _null,
prefix: x?.current_holder.prefix,
@ -2750,11 +2748,11 @@ export class CommandController extends Controller {
lastName: x?.current_holder.lastName,
organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null,
positionName: x?.current_holder.position ?? _null,
profileId: x?.current_holder.id ?? _null
profileId: x?.current_holder.id ?? _null,
});
});
}
return new HttpSuccess(_data);
}
@ -3346,6 +3344,7 @@ export class CommandController extends Controller {
commandCode?: string | null;
commandName?: string | null;
remark: string | null;
refId?: string | null;
}[];
},
) {
@ -3418,7 +3417,10 @@ export class CommandController extends Controller {
where: { id: item.commandId },
relations: ["commandType"],
});
if (command != null && command.commandType.code == "C-PM-15") {
if (
command != null &&
(command.commandType.code == "C-PM-15" || command.commandType.code == "C-PM-16")
) {
// ประวัติคำสั่งให้ช่วยราชการ
const dataAssis = new ProfileAssistance();
@ -3427,7 +3429,9 @@ export class CommandController extends Controller {
agency: item.officerOrg,
dateStart: item.dateStart,
dateEnd: item.dateEnd,
commandNo: item.commandNo,
commandNo: `${item.commandNo}/${item.commandYear}`,
commandName: item.commandName,
refId: item.refId,
refCommandDate: new Date(),
commandId: item.commandId,
createdUserId: req.user.sub,
@ -3485,6 +3489,7 @@ export class CommandController extends Controller {
commandCode?: string | null;
commandName?: string | null;
remark: string | null;
refId?: string | null;
}[];
},
) {
@ -3530,7 +3535,10 @@ export class CommandController extends Controller {
where: { id: item.commandId },
relations: ["commandType"],
});
if (command != null && command.commandType.code == "C-PM-15") {
if (
command != null &&
(command.commandType.code == "C-PM-15" || command.commandType.code == "C-PM-16")
) {
// ประวัติคำสั่งให้ช่วยราชการ
const dataAssis = new ProfileAssistance();
@ -3539,7 +3547,9 @@ export class CommandController extends Controller {
agency: item.officerOrg,
dateStart: item.dateStart,
dateEnd: item.dateEnd,
commandNo: item.commandNo,
commandNo: `${item.commandNo}/${item.commandYear}`,
commandName: item.commandName,
refId: item.refId,
refCommandDate: new Date(),
commandId: item.commandId,
createdUserId: req.user.sub,

View file

@ -45,6 +45,20 @@ export class ProfileAssistance extends EntityBase {
})
commandNo: string;
@Column({
nullable: true,
comment: "ชื่อคำสั่ง",
default: null,
})
commandName: string;
@Column({
nullable: true,
comment: "id อ้างอิงรายการ",
default: null,
})
refId: string;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง",

File diff suppressed because one or more lines are too long