ส่งตัวกลับ

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 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 }}

View file

@ -2599,7 +2599,7 @@ export class CommandController extends Controller {
}, },
@Request() request: RequestWithUser, @Request() request: RequestWithUser,
) { ) {
let _null:any = null; let _null: any = null;
let _data = new Array(); let _data = new Array();
const _posMasterCommission = await this.posMasterRepository.findOne({ const _posMasterCommission = await this.posMasterRepository.findOne({
where: { where: {
@ -2614,7 +2614,7 @@ export class CommandController extends Controller {
relations: ["current_holder", "orgRoot", "positions"], relations: ["current_holder", "orgRoot", "positions"],
order: { posMasterOrder: "ASC" }, order: { posMasterOrder: "ASC" },
}); });
if(_posMasterCommission) { if (_posMasterCommission) {
_data.push({ _data.push({
citizenId: _posMasterCommission?.current_holder.citizenId ?? _null, citizenId: _posMasterCommission?.current_holder.citizenId ?? _null,
prefix: _posMasterCommission?.current_holder.prefix, prefix: _posMasterCommission?.current_holder.prefix,
@ -2624,7 +2624,7 @@ export class CommandController extends Controller {
? _posMasterCommission.orgRoot.orgRootName ? _posMasterCommission.orgRoot.orgRootName
: _null, : _null,
positionName: _posMasterCommission?.current_holder.position ?? _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"], relations: ["current_holder", "orgRoot", "positions"],
order: { posMasterOrder: "ASC" }, order: { posMasterOrder: "ASC" },
}); });
if(_posMasterOfficer) { if (_posMasterOfficer) {
_data.push({ _data.push({
citizenId: _posMasterOfficer?.current_holder.citizenId ?? _null, citizenId: _posMasterOfficer?.current_holder.citizenId ?? _null,
prefix: _posMasterOfficer?.current_holder.prefix, prefix: _posMasterOfficer?.current_holder.prefix,
firstName: _posMasterOfficer?.current_holder.firstName, firstName: _posMasterOfficer?.current_holder.firstName,
lastName: _posMasterOfficer?.current_holder.lastName, lastName: _posMasterOfficer?.current_holder.lastName,
organizationName: _posMasterOfficer.orgRoot organizationName: _posMasterOfficer.orgRoot ? _posMasterOfficer.orgRoot.orgRootName : _null,
? _posMasterOfficer.orgRoot.orgRootName
: _null,
positionName: _posMasterOfficer?.current_holder.position ?? _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 }, orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
isDirector: true, isDirector: true,
current_holderId: Not(IsNull()), current_holderId: Not(IsNull()),
id: Not(In([_posMasterCommission?.id])) id: Not(In([_posMasterCommission?.id])),
}, },
{ {
orgChild1: In(_orgChild1), orgChild1: In(_orgChild1),
@ -2715,7 +2713,7 @@ export class CommandController extends Controller {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
isDirector: true, isDirector: true,
current_holderId: Not(IsNull()), current_holderId: Not(IsNull()),
id: Not(In([_posMasterOfficer?.id])) id: Not(In([_posMasterOfficer?.id])),
}, },
{ {
orgChild2: In(_orgChild2), orgChild2: In(_orgChild2),
@ -2742,7 +2740,7 @@ export class CommandController extends Controller {
relations: ["current_holder", "orgRoot"], relations: ["current_holder", "orgRoot"],
}); });
if (_posMaster.length > 0) { if (_posMaster.length > 0) {
_posMaster.forEach((x:any) => { _posMaster.forEach((x: any) => {
_data.push({ _data.push({
citizenId: x?.current_holder.citizenId ?? _null, citizenId: x?.current_holder.citizenId ?? _null,
prefix: x?.current_holder.prefix, prefix: x?.current_holder.prefix,
@ -2750,7 +2748,7 @@ export class CommandController extends Controller {
lastName: x?.current_holder.lastName, lastName: x?.current_holder.lastName,
organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null, organizationName: x.orgRoot ? x.orgRoot.orgRootName : _null,
positionName: x?.current_holder.position ?? _null, positionName: x?.current_holder.position ?? _null,
profileId: x?.current_holder.id ?? _null profileId: x?.current_holder.id ?? _null,
}); });
}); });
} }
@ -3346,6 +3344,7 @@ export class CommandController extends Controller {
commandCode?: string | null; commandCode?: string | null;
commandName?: string | null; commandName?: string | null;
remark: string | null; remark: string | null;
refId?: string | null;
}[]; }[];
}, },
) { ) {
@ -3418,7 +3417,10 @@ export class CommandController extends Controller {
where: { id: item.commandId }, where: { id: item.commandId },
relations: ["commandType"], 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(); const dataAssis = new ProfileAssistance();
@ -3427,7 +3429,9 @@ export class CommandController extends Controller {
agency: item.officerOrg, agency: item.officerOrg,
dateStart: item.dateStart, dateStart: item.dateStart,
dateEnd: item.dateEnd, dateEnd: item.dateEnd,
commandNo: item.commandNo, commandNo: `${item.commandNo}/${item.commandYear}`,
commandName: item.commandName,
refId: item.refId,
refCommandDate: new Date(), refCommandDate: new Date(),
commandId: item.commandId, commandId: item.commandId,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -3485,6 +3489,7 @@ export class CommandController extends Controller {
commandCode?: string | null; commandCode?: string | null;
commandName?: string | null; commandName?: string | null;
remark: string | null; remark: string | null;
refId?: string | null;
}[]; }[];
}, },
) { ) {
@ -3530,7 +3535,10 @@ export class CommandController extends Controller {
where: { id: item.commandId }, where: { id: item.commandId },
relations: ["commandType"], 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(); const dataAssis = new ProfileAssistance();
@ -3539,7 +3547,9 @@ export class CommandController extends Controller {
agency: item.officerOrg, agency: item.officerOrg,
dateStart: item.dateStart, dateStart: item.dateStart,
dateEnd: item.dateEnd, dateEnd: item.dateEnd,
commandNo: item.commandNo, commandNo: `${item.commandNo}/${item.commandYear}`,
commandName: item.commandName,
refId: item.refId,
refCommandDate: new Date(), refCommandDate: new Date(),
commandId: item.commandId, commandId: item.commandId,
createdUserId: req.user.sub, createdUserId: req.user.sub,

View file

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

File diff suppressed because one or more lines are too long