แก้env

This commit is contained in:
Kittapath 2024-07-09 00:03:18 +07:00
parent 1dceb4a114
commit 91cff0bf61
2 changed files with 159 additions and 455 deletions

View file

@ -9,7 +9,8 @@ env:
REGISTRY: docker.frappet.com REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-org-service IMAGE_NAME: ehr/bma-ehr-org-service
DEPLOY_HOST: frappet.com DEPLOY_HOST: frappet.com
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-org COMPOSE_PATH: /home/frappet/docker/bma-ehr
# COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-org
jobs: jobs:
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 # act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-test: release-test:

View file

@ -1166,50 +1166,27 @@ export class ProfileController extends Controller {
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
//profile.position, //profile.position,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType: positionType:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine: positionLine:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1266,50 +1243,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1362,50 +1314,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1458,50 +1385,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1568,50 +1470,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1664,50 +1541,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1760,50 +1612,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1856,50 +1683,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -1952,50 +1754,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -2048,50 +1825,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -2134,68 +1886,44 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
} }
let dateLeave_: any = body.date; let dateLeave_: any = body.date;
profile.isLeave = true; let null_: any = null;
profile.leaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง"; profile.isLeave = false;
profile.dateLeave = dateLeave_; profile.leaveReason = null_;
profile.dateLeave = null_;
profile.lastUpdateUserId = req.user.sub; profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name; profile.lastUpdateFullName = req.user.name;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), { // const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId, // profileId: body.profileId,
date: body.date, // date: body.date,
refCommandNo: body.refCommandNo, // refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, // templateDoc: body.salaryRef,
position: // position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 // positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position // positionLevel:
: null, // profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
positionType: // posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
profile.profileSalary.length > 0 // positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionType // positionPathSide:
: null, // profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionLevel: // positionExecutive:
profile.profileSalary.length > 0 // profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel // amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null, // positionSalaryAmount:
posNo: // profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
profile.profileSalary.length > 0 // mouthSalaryAmount:
? profile.profileSalary[profile.profileSalary.length - 1].posNo // profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
: null, // order:
positionLine: // profile.profileSalary.length >= 0
profile.profileSalary.length > 0 // ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine // ? profile.profileSalary[0].order + 1
: null, // : 1
positionPathSide: // : null,
profile.profileSalary.length > 0 // createdUserId: req.user.sub,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide // createdFullName: req.user.name,
: null, // lastUpdateUserId: req.user.sub,
positionExecutive: // lastUpdateFullName: req.user.name,
profile.profileSalary.length > 0 // });
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive await Promise.all([this.profileRepo.save(profile)]);
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
: 1
: null,
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
});
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess(); return new HttpSuccess();
} }
@ -2240,50 +1968,25 @@ export class ProfileController extends Controller {
date: body.date, date: body.date,
refCommandNo: body.refCommandNo, refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef, templateDoc: body.salaryRef,
position: position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
profile.profileSalary.length > 0 positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
? profile.profileSalary[profile.profileSalary.length - 1].position
: null,
positionType:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionType
: null,
positionLevel: positionLevel:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
: null, positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
posNo:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].posNo
: null,
positionLine:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
: null,
positionPathSide: positionPathSide:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
: null,
positionExecutive: positionExecutive:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
: null,
amount:
profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].amount
: null,
positionSalaryAmount: positionSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
: null,
mouthSalaryAmount: mouthSalaryAmount:
profile.profileSalary.length > 0 profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
: null,
order: order:
profile.profileSalary.length >= 0 profile.profileSalary.length >= 0
? profile.profileSalary.length > 0 ? profile.profileSalary.length > 0
? profile.profileSalary[profile.profileSalary.length - 1].order + 1 ? profile.profileSalary[0].order + 1
: 1 : 1
: null, : null,
createdUserId: req.user.sub, createdUserId: req.user.sub,