Merge branch 'develop'
This commit is contained in:
commit
bf0c30151a
24 changed files with 350 additions and 72 deletions
59
.github/workflows/release.yaml
vendored
59
.github/workflows/release.yaml
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
name: release-test
|
name: release
|
||||||
run-name: release-test ${{ github.actor }}
|
run-name: release ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -9,11 +9,11 @@ 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-ehr
|
|
||||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-org
|
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:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
@ -67,21 +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
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
- name: Notify Discord Success
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
run: |
|
||||||
access_token: ${{ secrets.TOKEN_LINE }}
|
curl -H "Content-Type: application/json" \
|
||||||
message: |
|
-X POST \
|
||||||
-Success✅✅✅
|
-d '{
|
||||||
Image: ${{env.IMAGE_NAME}}
|
"embeds": [{
|
||||||
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
|
"title": "✅ Deployment Success!",
|
||||||
By: ${{github.actor}}
|
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
"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()
|
if: failure()
|
||||||
with:
|
run: |
|
||||||
access_token: ${{ secrets.TOKEN_LINE }}
|
curl -H "Content-Type: application/json" \
|
||||||
message: |
|
-X POST \
|
||||||
-Failure❌❌❌
|
-d '{
|
||||||
Image: ${{env.IMAGE_NAME}}
|
"embeds": [{
|
||||||
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
|
"title": "❌ Deployment Failed!",
|
||||||
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,
|
||||||
|
"footer": {
|
||||||
|
"text": "Release Notification",
|
||||||
|
"icon_url": "https://example.com/failure-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|
|
||||||
|
|
@ -128,4 +128,56 @@ export class ApiKeyController extends Controller {
|
||||||
});
|
});
|
||||||
return new HttpSuccess(apiName);
|
return new HttpSuccess(apiName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API สร้าง Api Key
|
||||||
|
*
|
||||||
|
* @summary สร้าง Api Key (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("history")
|
||||||
|
async getHistory(
|
||||||
|
@Body()
|
||||||
|
requestBody: {
|
||||||
|
startDate: Date;
|
||||||
|
endDate: Date;
|
||||||
|
apiNameId: string | null;
|
||||||
|
},
|
||||||
|
@Request() request: RequestWithUser,
|
||||||
|
) {
|
||||||
|
if (requestBody.apiNameId) {
|
||||||
|
const apiName = await this.apiNameRepository.findOne({
|
||||||
|
where: { id: requestBody.apiNameId },
|
||||||
|
});
|
||||||
|
if (!apiName)
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรายการ Web Service นี้ในระบบ");
|
||||||
|
}
|
||||||
|
const apiHistory = await AppDataSource.getRepository(ApiHistory)
|
||||||
|
.createQueryBuilder("apiHistory")
|
||||||
|
.leftJoinAndSelect("apiHistory.apiKey", "apiKey")
|
||||||
|
.leftJoinAndSelect("apiHistory.apiName", "apiName")
|
||||||
|
.andWhere(requestBody.apiNameId ? `apiHistory.apiNameId = :apiNameId` : "1=1", {
|
||||||
|
apiNameId: requestBody.apiNameId,
|
||||||
|
})
|
||||||
|
.andWhere(
|
||||||
|
`apiHistory.createdAt >= DATE(:startDate) AND apiHistory.createdAt <= DATE(:endDate)`,
|
||||||
|
{
|
||||||
|
startDate: new Date(requestBody.startDate),
|
||||||
|
endDate: new Date(
|
||||||
|
requestBody.endDate.setDate(new Date(requestBody.endDate).getDate() + 1),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orderBy("apiHistory.createdAt", "DESC")
|
||||||
|
.getMany();
|
||||||
|
const result = apiHistory.map((x) => ({
|
||||||
|
id: x.id,
|
||||||
|
apiName: x.apiName.name,
|
||||||
|
apiKey: x.apiKey.name,
|
||||||
|
createdAt: x.createdAt,
|
||||||
|
ipApi: x.ipApi,
|
||||||
|
}));
|
||||||
|
|
||||||
|
return new HttpSuccess(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1622,12 +1622,16 @@ export class CommandController extends Controller {
|
||||||
remarkVertical?: string | null;
|
remarkVertical?: string | null;
|
||||||
remarkHorizontal?: string | null;
|
remarkHorizontal?: string | null;
|
||||||
rootId?: string | null;
|
rootId?: string | null;
|
||||||
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
|
positionSalaryAmount?: Double | null;
|
||||||
|
mouthSalaryAmount?: Double | null;
|
||||||
}[];
|
}[];
|
||||||
},
|
},
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
) {
|
) {
|
||||||
let command = new Command();
|
let command = new Command();
|
||||||
let commandCode = null;
|
let commandCode:string = "";
|
||||||
let null_: any = null;
|
let null_: any = null;
|
||||||
if (
|
if (
|
||||||
requestBody.commandId != undefined &&
|
requestBody.commandId != undefined &&
|
||||||
|
|
@ -1707,30 +1711,40 @@ export class CommandController extends Controller {
|
||||||
commandRecive = Object.assign(new CommandRecive(), item);
|
commandRecive = Object.assign(new CommandRecive(), item);
|
||||||
commandRecive.order = order;
|
commandRecive.order = order;
|
||||||
let salaryData = null_;
|
let salaryData = null_;
|
||||||
if (item.profileId) {
|
|
||||||
salaryData = await this.profileRepository.findOne({
|
const excludedCommands = ["C-PM-33", "C-PM-34", "C-PM-35", "C-PM-36", "C-PM-37"];
|
||||||
where: {
|
if (!excludedCommands.includes(commandCode)) {
|
||||||
id: item.profileId,
|
if (item.profileId) {
|
||||||
},
|
salaryData = await this.profileRepository.findOne({
|
||||||
});
|
|
||||||
let null_: any = 0;
|
|
||||||
if (!salaryData) {
|
|
||||||
salaryData = await this.profileEmployeeRepository.findOne({
|
|
||||||
where: {
|
where: {
|
||||||
id: item.profileId,
|
id: item.profileId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
let null_: any = 0;
|
||||||
|
if (!salaryData) {
|
||||||
|
salaryData = await this.profileEmployeeRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: item.profileId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
commandRecive.amount = salaryData ? salaryData.amount : null_;
|
||||||
|
commandRecive.positionSalaryAmount = salaryData
|
||||||
|
? salaryData.positionSalaryAmount
|
||||||
|
: null_;
|
||||||
|
commandRecive.mouthSalaryAmount = salaryData ? salaryData.mouthSalaryAmount : null_;
|
||||||
|
} else {
|
||||||
|
commandRecive.amount = null_;
|
||||||
|
commandRecive.positionSalaryAmount = null_;
|
||||||
|
commandRecive.mouthSalaryAmount = null_;
|
||||||
}
|
}
|
||||||
commandRecive.amount = salaryData ? salaryData.amount : null_;
|
|
||||||
commandRecive.positionSalaryAmount = salaryData
|
|
||||||
? salaryData.positionSalaryAmount
|
|
||||||
: null_;
|
|
||||||
commandRecive.mouthSalaryAmount = salaryData ? salaryData.mouthSalaryAmount : null_;
|
|
||||||
} else {
|
} else {
|
||||||
commandRecive.amount = null_;
|
commandRecive.amount = item.amount ?? null_;
|
||||||
commandRecive.positionSalaryAmount = null_;
|
commandRecive.amountSpecial = item.amountSpecial ?? null_;
|
||||||
commandRecive.mouthSalaryAmount = null_;
|
commandRecive.positionSalaryAmount = item.positionSalaryAmount ?? null_;
|
||||||
|
commandRecive.mouthSalaryAmount = item.mouthSalaryAmount ?? null_;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandRecive.remarkVertical =
|
commandRecive.remarkVertical =
|
||||||
item.remarkVertical == null ? null_ : item.remarkVertical;
|
item.remarkVertical == null ? null_ : item.remarkVertical;
|
||||||
commandRecive.remarkHorizontal =
|
commandRecive.remarkHorizontal =
|
||||||
|
|
@ -1898,6 +1912,7 @@ export class CommandController extends Controller {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -1917,7 +1932,7 @@ export class CommandController extends Controller {
|
||||||
) {
|
) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
const profile = await this.profileRepository.findOneBy({ id: item.profileId });
|
const profile:any = await this.profileRepository.findOneBy({ id: item.profileId });
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||||
}
|
}
|
||||||
|
|
@ -2002,6 +2017,8 @@ export class CommandController extends Controller {
|
||||||
profile.posLevelId = positionNew.posLevelId;
|
profile.posLevelId = positionNew.posLevelId;
|
||||||
profile.posTypeId = positionNew.posTypeId;
|
profile.posTypeId = positionNew.posTypeId;
|
||||||
profile.position = positionNew.positionName;
|
profile.position = positionNew.positionName;
|
||||||
|
profile.amount = item.amount ?? null;
|
||||||
|
profile.amountSpecial = item.amountSpecial ?? null;
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
await this.positionRepository.save(positionNew);
|
await this.positionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
|
|
@ -2020,6 +2037,7 @@ export class CommandController extends Controller {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -2036,7 +2054,7 @@ export class CommandController extends Controller {
|
||||||
) {
|
) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
const profile = await this.profileEmployeeRepository.findOneBy({ id: item.profileId });
|
const profile:any = await this.profileEmployeeRepository.findOneBy({ id: item.profileId });
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
|
@ -2131,7 +2149,8 @@ export class CommandController extends Controller {
|
||||||
profile.position = positionNew.positionName;
|
profile.position = positionNew.positionName;
|
||||||
profile.employeeOc = posMaster?.orgRoot?.orgRootName ?? null;
|
profile.employeeOc = posMaster?.orgRoot?.orgRootName ?? null;
|
||||||
profile.positionEmployeePositionId = positionNew.positionName;
|
profile.positionEmployeePositionId = positionNew.positionName;
|
||||||
|
profile.amount = item.amount ?? null;
|
||||||
|
profile.amountSpecial = item.amountSpecial ?? null;
|
||||||
await this.profileEmployeeRepository.save(profile);
|
await this.profileEmployeeRepository.save(profile);
|
||||||
await this.employeePositionRepository.save(positionNew);
|
await this.employeePositionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
|
|
@ -2150,6 +2169,7 @@ export class CommandController extends Controller {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -2240,8 +2260,8 @@ export class CommandController extends Controller {
|
||||||
firstName: profile.firstName,
|
firstName: profile.firstName,
|
||||||
lastName: profile.lastName,
|
lastName: profile.lastName,
|
||||||
});
|
});
|
||||||
// กรณี Keycloak ไม่ถูกลบ ให้ลบซ้ำอีกรอบแล้วสร้างใหม่
|
// กรณี Keycloak ไม่ถูกลบ ให้ลบซ้ำอีกรอบแล้วสร้างใหม่ และหากยังไม่สามารถลบได้ให้แสดง Error
|
||||||
if (profile.keycloak != null && userKeycloakId && userKeycloakId.error === "User exists with same username") {
|
if (profile.keycloak != null && userKeycloakId && userKeycloakId.errorMessage === "User exists with same username") {
|
||||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||||
if(delUserKeycloak) {
|
if(delUserKeycloak) {
|
||||||
userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
|
userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
|
||||||
|
|
@ -2249,6 +2269,9 @@ export class CommandController extends Controller {
|
||||||
lastName: profile.lastName,
|
lastName: profile.lastName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
throw new HttpError(HttpStatus.BAD_REQUEST, "พบข้อผิดพลาด ไม่สามารถจัดการผู้ใช้งานได้");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const list = await getRoles();
|
const list = await getRoles();
|
||||||
let result = false;
|
let result = false;
|
||||||
|
|
@ -2263,6 +2286,8 @@ export class CommandController extends Controller {
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
profile.amount = item.amount ?? _null;
|
||||||
|
profile.amountSpecial = item.amountSpecial ?? _null;
|
||||||
profile.isActive = true;
|
profile.isActive = true;
|
||||||
profile.keycloak = typeof userKeycloakId === "string" ? userKeycloakId : "";
|
profile.keycloak = typeof userKeycloakId === "string" ? userKeycloakId : "";
|
||||||
profile.roleKeycloaks = result && roleKeycloak ? [roleKeycloak] : [];
|
profile.roleKeycloaks = result && roleKeycloak ? [roleKeycloak] : [];
|
||||||
|
|
@ -2380,6 +2405,7 @@ export class CommandController extends Controller {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -2400,7 +2426,7 @@ export class CommandController extends Controller {
|
||||||
) {
|
) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
body.data.map(async (item) => {
|
body.data.map(async (item) => {
|
||||||
const profile = await this.profileRepository.findOne({
|
const profile:any = await this.profileRepository.findOne({
|
||||||
where: { id: item.profileId },
|
where: { id: item.profileId },
|
||||||
relations: ["roleKeycloaks"],
|
relations: ["roleKeycloaks"],
|
||||||
});
|
});
|
||||||
|
|
@ -2443,6 +2469,8 @@ export class CommandController extends Controller {
|
||||||
profile.posLevelId = _null;
|
profile.posLevelId = _null;
|
||||||
profile.leaveReason = item.leaveReason ?? _null;
|
profile.leaveReason = item.leaveReason ?? _null;
|
||||||
profile.dateLeave = item.dateLeave ?? _null;
|
profile.dateLeave = item.dateLeave ?? _null;
|
||||||
|
profile.amount = item.amount ?? _null;
|
||||||
|
profile.amountSpecial = item.amountSpecial ?? _null;
|
||||||
await this.profileRepository.save(profile, { data: req });
|
await this.profileRepository.save(profile, { data: req });
|
||||||
}
|
}
|
||||||
Object.assign(data, { ...item, ...meta });
|
Object.assign(data, { ...item, ...meta });
|
||||||
|
|
@ -3084,6 +3112,8 @@ export class CommandController extends Controller {
|
||||||
profile.roleKeycloaks = result && roleKeycloak ? [roleKeycloak] : [];
|
profile.roleKeycloaks = result && roleKeycloak ? [roleKeycloak] : [];
|
||||||
profile.email = item.bodyProfile.email;
|
profile.email = item.bodyProfile.email;
|
||||||
profile.dateStart = item.bodyProfile.dateStart;
|
profile.dateStart = item.bodyProfile.dateStart;
|
||||||
|
profile.amount = item.bodyProfile.amount ?? null;
|
||||||
|
profile.amountSpecial = item.bodyProfile.amountSpecial ?? null;
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
setLogDataDiff(req, { before, after: profile });
|
setLogDataDiff(req, { before, after: profile });
|
||||||
}
|
}
|
||||||
|
|
@ -3127,13 +3157,17 @@ export class CommandController extends Controller {
|
||||||
where: { profileId: profile.id },
|
where: { profileId: profile.id },
|
||||||
order: { order: "DESC" },
|
order: { order: "DESC" },
|
||||||
});
|
});
|
||||||
const profileSal = new ProfileSalary();
|
const profileSal: any = new ProfileSalary();
|
||||||
Object.assign(profileSal, { ...item.bodySalarys, ...meta });
|
Object.assign(profileSal, { ...item.bodySalarys, ...meta });
|
||||||
const salaryHistory = new ProfileSalaryHistory();
|
const salaryHistory = new ProfileSalaryHistory();
|
||||||
Object.assign(salaryHistory, { ...profileSal, id: undefined });
|
Object.assign(salaryHistory, { ...profileSal, id: undefined });
|
||||||
profileSal.order = dest_item == null ? 1 : dest_item.order + 1;
|
profileSal.order = dest_item == null ? 1 : dest_item.order + 1;
|
||||||
profileSal.profileId = profile.id;
|
profileSal.profileId = profile.id;
|
||||||
profileSal.dateGovernment = meta.createdAt;
|
profileSal.dateGovernment = meta.createdAt;
|
||||||
|
profileSal.amount = item.bodySalarys.amount ?? null;
|
||||||
|
profileSal.amountSpecial = item.bodySalarys.amountSpecial ?? null;
|
||||||
|
profileSal.positionSalaryAmount = item.bodySalarys.positionSalaryAmount ?? null;
|
||||||
|
profileSal.mouthSalaryAmount = item.bodySalarys.mouthSalaryAmount ?? null;
|
||||||
await this.salaryRepo.save(profileSal, { data: req });
|
await this.salaryRepo.save(profileSal, { data: req });
|
||||||
setLogDataDiff(req, { before, after: profileSal });
|
setLogDataDiff(req, { before, after: profileSal });
|
||||||
salaryHistory.profileSalaryId = profileSal.id;
|
salaryHistory.profileSalaryId = profileSal.id;
|
||||||
|
|
@ -3281,6 +3315,7 @@ export class CommandController extends Controller {
|
||||||
commandYear: number;
|
commandYear: number;
|
||||||
templateDoc: string | null;
|
templateDoc: string | null;
|
||||||
amount: Double | null;
|
amount: Double | null;
|
||||||
|
amountSpecial: Double | null;
|
||||||
positionSalaryAmount: Double | null;
|
positionSalaryAmount: Double | null;
|
||||||
mouthSalaryAmount: Double | null;
|
mouthSalaryAmount: Double | null;
|
||||||
}[];
|
}[];
|
||||||
|
|
@ -3310,6 +3345,7 @@ export class CommandController extends Controller {
|
||||||
profileEmployeeId: profile.id,
|
profileEmployeeId: profile.id,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
amount: item.amount,
|
amount: item.amount,
|
||||||
|
amountSpecial: item.amountSpecial,
|
||||||
commandId: item.commandId,
|
commandId: item.commandId,
|
||||||
positionSalaryAmount: item.positionSalaryAmount,
|
positionSalaryAmount: item.positionSalaryAmount,
|
||||||
mouthSalaryAmount: item.mouthSalaryAmount,
|
mouthSalaryAmount: item.mouthSalaryAmount,
|
||||||
|
|
@ -3428,9 +3464,8 @@ export class CommandController extends Controller {
|
||||||
const _null: any = null;
|
const _null: any = null;
|
||||||
profile.employeeWage = item.amount == null ? _null : item.amount.toString();
|
profile.employeeWage = item.amount == null ? _null : item.amount.toString();
|
||||||
profile.dateStart = new Date();
|
profile.dateStart = new Date();
|
||||||
// profile.amount = item.amount == null ? _null : item.amount.toString(); //เผื่อไว้
|
profile.amount = item.amount == null ? _null : item.amount;
|
||||||
// profile.positionSalaryAmount = item.positionSalaryAmount == null ? _null : item.positionSalaryAmount.toString();
|
profile.amountSpecial = item.amountSpecial == null ? _null : item.amountSpecial;
|
||||||
// profile.mouthSalaryAmount = item.mouthSalaryAmount == null ? _null : item.mouthSalaryAmount.toString();
|
|
||||||
|
|
||||||
await this.profileEmployeeRepository.save(profile);
|
await this.profileEmployeeRepository.save(profile);
|
||||||
await this.employeePositionRepository.save(positionNew);
|
await this.employeePositionRepository.save(positionNew);
|
||||||
|
|
|
||||||
|
|
@ -163,10 +163,11 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
: item.positions?.find((position) => position.positionIsSelected == true)?.posExecutive
|
: item.positions?.find((position) => position.positionIsSelected == true)?.posExecutive
|
||||||
.posExecutiveName;
|
.posExecutiveName;
|
||||||
|
|
||||||
const amount =
|
// const amount =
|
||||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||||
|
const amount = item.current_holder?item.current_holder.amount:null;
|
||||||
let datePeriodStart = new Date(
|
let datePeriodStart = new Date(
|
||||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
);
|
);
|
||||||
|
|
@ -380,10 +381,11 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
orgShortName = item.orgChild4?.orgChild4ShortName;
|
orgShortName = item.orgChild4?.orgChild4ShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const amount =
|
// const amount =
|
||||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||||
|
const amount = item.current_holder?item.current_holder.amount:null;
|
||||||
let datePeriodStart = new Date(
|
let datePeriodStart = new Date(
|
||||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7247,10 +7247,11 @@ export class ProfileController extends Controller {
|
||||||
: item.positions?.find((position) => position.positionIsSelected == true)?.posExecutive
|
: item.positions?.find((position) => position.positionIsSelected == true)?.posExecutive
|
||||||
.posExecutiveName;
|
.posExecutiveName;
|
||||||
|
|
||||||
const amount =
|
// const amount =
|
||||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||||
|
const amount = item.current_holder?item.current_holder.amount:null;
|
||||||
let datePeriodStart = new Date(
|
let datePeriodStart = new Date(
|
||||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2950,10 +2950,11 @@ export class ProfileEmployeeController extends Controller {
|
||||||
orgShortName = item.orgChild4?.orgChild4ShortName;
|
orgShortName = item.orgChild4?.orgChild4ShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const amount =
|
// const amount =
|
||||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||||
|
const amount = item.current_holder?item.current_holder.amount:null;
|
||||||
let datePeriodStart = new Date(
|
let datePeriodStart = new Date(
|
||||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2699,10 +2699,11 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
orgShortName = item.orgChild4?.orgChild4ShortName;
|
orgShortName = item.orgChild4?.orgChild4ShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const amount =
|
// const amount =
|
||||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||||
? null
|
// ? null
|
||||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||||
|
const amount = item.current_holder?item.current_holder.amount:null;
|
||||||
let datePeriodStart = new Date(
|
let datePeriodStart = new Date(
|
||||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ export class ProfileSalaryController extends Controller {
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
lastUpdatedAt: new Date(),
|
lastUpdatedAt: new Date(),
|
||||||
};
|
};
|
||||||
|
const _null:any = null;
|
||||||
Object.assign(data, { ...body, ...meta });
|
Object.assign(data, { ...body, ...meta });
|
||||||
const history = new ProfileSalaryHistory();
|
const history = new ProfileSalaryHistory();
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
@ -131,6 +131,11 @@ export class ProfileSalaryController extends Controller {
|
||||||
history.profileSalaryId = data.id;
|
history.profileSalaryId = data.id;
|
||||||
await this.salaryHistoryRepo.save(history, { data: req });
|
await this.salaryHistoryRepo.save(history, { data: req });
|
||||||
|
|
||||||
|
profile.amount = body?.amount??_null;
|
||||||
|
profile.positionSalaryAmount = body?.positionSalaryAmount??_null;
|
||||||
|
profile.mouthSalaryAmount = body.mouthSalaryAmount??_null;
|
||||||
|
await this.profileRepo.save(profile, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,6 +178,7 @@ export class ProfileSalaryController extends Controller {
|
||||||
|
|
||||||
let null_:any = null;
|
let null_:any = null;
|
||||||
profile.amount = body.amount ?? null_;
|
profile.amount = body.amount ?? null_;
|
||||||
|
profile.amountSpecial = body.amountSpecial ?? null_;
|
||||||
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
|
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
|
||||||
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_;
|
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_;
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
|
||||||
|
|
@ -137,12 +137,17 @@ export class ProfileSalaryEmployeeController extends Controller {
|
||||||
Object.assign(data, { ...body, ...meta });
|
Object.assign(data, { ...body, ...meta });
|
||||||
const history = new ProfileSalaryHistory();
|
const history = new ProfileSalaryHistory();
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
const _null:any = null;
|
||||||
await this.salaryRepo.save(data, { data: req });
|
await this.salaryRepo.save(data, { data: req });
|
||||||
setLogDataDiff(req, { before, after: data });
|
setLogDataDiff(req, { before, after: data });
|
||||||
history.profileSalaryId = data.id;
|
history.profileSalaryId = data.id;
|
||||||
await this.salaryHistoryRepo.save(history, { data: req });
|
await this.salaryHistoryRepo.save(history, { data: req });
|
||||||
|
|
||||||
|
profile.amount = body?.amount??_null;
|
||||||
|
profile.positionSalaryAmount = body?.positionSalaryAmount??_null;
|
||||||
|
profile.mouthSalaryAmount = body.mouthSalaryAmount??_null;
|
||||||
|
await this.profileRepo.save(profile, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,6 +194,7 @@ export class ProfileSalaryEmployeeController extends Controller {
|
||||||
|
|
||||||
let null_:any = null;
|
let null_:any = null;
|
||||||
profile.amount = body.amount ?? null_;
|
profile.amount = body.amount ?? null_;
|
||||||
|
profile.amountSpecial = body.amountSpecial ?? null_;
|
||||||
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
|
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
|
||||||
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_;
|
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_;
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export const AppDataSource = new DataSource({
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
connectorPackage: "mysql2",
|
connectorPackage: "mysql2",
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
logging: ["query", "error"],
|
logging: true,
|
||||||
entities:
|
entities:
|
||||||
process.env.NODE_ENV !== "production"
|
process.env.NODE_ENV !== "production"
|
||||||
? ["src/entities/**/*.ts"]
|
? ["src/entities/**/*.ts"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
import { ApiKey } from "./ApiKey";
|
import { ApiKey } from "./ApiKey";
|
||||||
|
import { ApiName } from "./ApiName";
|
||||||
|
|
||||||
@Entity("apiHistory")
|
@Entity("apiHistory")
|
||||||
export class ApiHistory extends EntityBase {
|
export class ApiHistory extends EntityBase {
|
||||||
|
|
@ -63,4 +64,16 @@ export class ApiHistory extends EntityBase {
|
||||||
@ManyToOne(() => ApiKey, (apiKey) => apiKey.apiHistorys)
|
@ManyToOne(() => ApiKey, (apiKey) => apiKey.apiHistorys)
|
||||||
@JoinColumn({ name: "apiKeyId" })
|
@JoinColumn({ name: "apiKeyId" })
|
||||||
apiKey: ApiKey;
|
apiKey: ApiKey;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 40,
|
||||||
|
comment: "คีย์นอก(FK)ของตาราง ApiName",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
apiNameId: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => ApiName, (apiName) => apiName.apiHistorys)
|
||||||
|
@JoinColumn({ name: "apiNameId" })
|
||||||
|
apiName: ApiName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Entity, Column, ManyToMany, JoinTable } from "typeorm";
|
import { Entity, Column, ManyToMany, JoinTable, OneToMany } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
import { ApiKey } from "./ApiKey";
|
import { ApiKey } from "./ApiKey";
|
||||||
|
import { ApiHistory } from "./ApiHistory";
|
||||||
|
|
||||||
@Entity("apiName")
|
@Entity("apiName")
|
||||||
export class ApiName extends EntityBase {
|
export class ApiName extends EntityBase {
|
||||||
|
|
@ -31,4 +32,7 @@ export class ApiName extends EntityBase {
|
||||||
@ManyToMany(() => ApiKey, (apiKey) => apiKey.apiNames)
|
@ManyToMany(() => ApiKey, (apiKey) => apiKey.apiNames)
|
||||||
@JoinTable()
|
@JoinTable()
|
||||||
apiKeys: ApiKey[];
|
apiKeys: ApiKey[];
|
||||||
|
|
||||||
|
@OneToMany(() => ApiHistory, (v) => v.apiName)
|
||||||
|
apiHistorys: ApiHistory[];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,14 @@ export class CommandRecive extends EntityBase {
|
||||||
})
|
})
|
||||||
amount: Double;
|
amount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "เงินพิเศษ",
|
||||||
|
default: 0,
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
amountSpecial: Double;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "เงินประจำตำแหน่ง",
|
comment: "เงินประจำตำแหน่ง",
|
||||||
default: 0,
|
default: 0,
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,12 @@ export class CommandType extends EntityBase {
|
||||||
})
|
})
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "สถานะแก้ไขเงินเดือน",
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
isSalary: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "คำอธิบาย",
|
comment: "คำอธิบาย",
|
||||||
|
|
@ -119,6 +125,9 @@ export class CreateCommandType {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
isSalary?: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateCommandType = Partial<CreateCommandType>;
|
export type UpdateCommandType = Partial<CreateCommandType>;
|
||||||
|
|
|
||||||
|
|
@ -339,6 +339,14 @@ export class Profile extends EntityBase {
|
||||||
})
|
})
|
||||||
amount: Double;
|
amount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "เงินพิเศษ",
|
||||||
|
default: 0,
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
amountSpecial: Double;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "เงินประจำตำแหน่ง",
|
comment: "เงินประจำตำแหน่ง",
|
||||||
default: 0,
|
default: 0,
|
||||||
|
|
@ -778,6 +786,8 @@ export class CreateProfileAllFields {
|
||||||
currentDistrictId: string | null;
|
currentDistrictId: string | null;
|
||||||
currentSubDistrictId: string | null;
|
currentSubDistrictId: string | null;
|
||||||
currentZipCode: string | null;
|
currentZipCode: string | null;
|
||||||
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateProfile = {
|
export type UpdateProfile = {
|
||||||
|
|
|
||||||
|
|
@ -592,6 +592,14 @@ export class ProfileEmployee extends EntityBase {
|
||||||
})
|
})
|
||||||
amount: Double;
|
amount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "เงินพิเศษ",
|
||||||
|
default: 0,
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
amountSpecial: Double;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "เงินประจำตำแหน่ง",
|
comment: "เงินประจำตำแหน่ง",
|
||||||
default: 0,
|
default: 0,
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,14 @@ export class ProfileSalary extends EntityBase {
|
||||||
})
|
})
|
||||||
amount: Double;
|
amount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "เงินพิเศษ",
|
||||||
|
default: 0,
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
amountSpecial: Double;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "เงินประจำตำแหน่ง",
|
comment: "เงินประจำตำแหน่ง",
|
||||||
default: 0,
|
default: 0,
|
||||||
|
|
@ -184,6 +192,7 @@ export class CreateProfileSalary {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -204,6 +213,7 @@ export class CreateProfileSalaryEmployee {
|
||||||
profileEmployeeId: string | null;
|
profileEmployeeId: string | null;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
commandId?: string | null;
|
commandId?: string | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
|
|
@ -221,6 +231,7 @@ export class CreateProfileSalaryEmployee {
|
||||||
export class UpdateProfileSalaryEmployee {
|
export class UpdateProfileSalaryEmployee {
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -237,6 +248,7 @@ export class UpdateProfileSalaryEmployee {
|
||||||
export type UpdateProfileSalary = {
|
export type UpdateProfileSalary = {
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo?: string | null;
|
posNo?: string | null;
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,14 @@ export class ProfileSalaryHistory extends EntityBase {
|
||||||
})
|
})
|
||||||
amount: Double;
|
amount: Double;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "เงินพิเศษ",
|
||||||
|
default: 0,
|
||||||
|
nullable: true,
|
||||||
|
type: "double",
|
||||||
|
})
|
||||||
|
amountSpecial: Double;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "เงินประจำตำแหน่ง",
|
comment: "เงินประจำตำแหน่ง",
|
||||||
default: 0,
|
default: 0,
|
||||||
|
|
@ -149,6 +157,7 @@ export class CreateProfileSalaryHistory {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
|
|
@ -165,6 +174,7 @@ export class CreateProfileSalaryHistory {
|
||||||
export class UpdateProfileSalaryHistory {
|
export class UpdateProfileSalaryHistory {
|
||||||
date?: Date | null;
|
date?: Date | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
|
amountSpecial?: Double | null;
|
||||||
positionSalaryAmount?: Double | null;
|
positionSalaryAmount?: Double | null;
|
||||||
mouthSalaryAmount?: Double | null;
|
mouthSalaryAmount?: Double | null;
|
||||||
posNo?: string | null;
|
posNo?: string | null;
|
||||||
|
|
|
||||||
16
src/migration/1733318856709-update_keyapi_add_KeynameId.ts
Normal file
16
src/migration/1733318856709-update_keyapi_add_KeynameId.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateKeyapiAddKeynameId1733318856709 implements MigrationInterface {
|
||||||
|
name = 'UpdateKeyapiAddKeynameId1733318856709'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD \`apiNameId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ApiName'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`apiHistory\` ADD CONSTRAINT \`FK_0b7ae98d4f342bf920339ada78b\` FOREIGN KEY (\`apiNameId\`) REFERENCES \`apiName\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP FOREIGN KEY \`FK_0b7ae98d4f342bf920339ada78b\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`apiHistory\` DROP COLUMN \`apiNameId\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableProfileSalaryAddAmountSpecial1733463321778 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableProfileSalaryAddAmountSpecial1733463321778'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class Update3table_addAmountSpecial1733471256767 implements MigrationInterface {
|
||||||
|
name = 'Update3table_addAmountSpecial1733471256767'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableCommandTypeAddIsSalary1733482389096 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableCommandTypeAddIsSalary1733482389096'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`isSalary\` tinyint NOT NULL COMMENT 'สถานะแก้ไขเงินเดือน' DEFAULT 1`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`isSalary\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
src/migration/1733798795372-update_table_add_field.ts
Normal file
14
src/migration/1733798795372-update_table_add_field.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableAddField1733798795372 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableAddField1733798795372'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`amountSpecial\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -98,6 +98,7 @@ async function handler(msg: amqp.ConsumeMessage): Promise<boolean> {
|
||||||
commandId: command.id,
|
commandId: command.id,
|
||||||
templateDoc: command.positionDetail,
|
templateDoc: command.positionDetail,
|
||||||
amount: x.amount,
|
amount: x.amount,
|
||||||
|
amountSpecial: x.amountSpecial,
|
||||||
positionSalaryAmount: x.positionSalaryAmount,
|
positionSalaryAmount: x.positionSalaryAmount,
|
||||||
mouthSalaryAmount: x.mouthSalaryAmount,
|
mouthSalaryAmount: x.mouthSalaryAmount,
|
||||||
})),
|
})),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue