Merge branch 'develop'

This commit is contained in:
Warunee Tamkoo 2025-08-06 15:39:27 +07:00
commit 40c852cba9
65 changed files with 242 additions and 13743 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

@ -6658,8 +6658,8 @@ export class CommandController extends Controller {
createdAt: new Date(), createdAt: new Date(),
lastUpdatedAt: new Date(), lastUpdatedAt: new Date(),
commandNo: firstRef.commandNo ?? null, commandNo: firstRef.commandNo ?? null,
refCommandNo: `${firstRef.commandNo ?? ""}/${firstRef.commandYear ?? ""}`, refCommandNo: `${firstRef.commandNo ?? ""}/${firstRef.commandYear ? Extension.ToThaiYear(firstRef.commandYear) : ""}`,
commandYear: firstRef.commandYear ?? null, commandYear: firstRef.commandYear ? Extension.ToThaiYear(firstRef.commandYear) : null,
posNo: posNo:
orgShortName && item.posMaster?.posMasterNo orgShortName && item.posMaster?.posMasterNo
? `${orgShortName} ${item.posMaster.posMasterNo}` ? `${orgShortName} ${item.posMaster.posMasterNo}`

View file

@ -20,88 +20,88 @@ import * as fs from "fs";
import * as path from "path"; import * as path from "path";
const { createConnection } = require("typeorm"); const { createConnection } = require("typeorm");
import csvParser from "csv-parser"; import csvParser from "csv-parser";
import { HR_PERSONAL_OFFICER_FAMILY } from "../entities/HR_PERSONAL_OFFICER_FAMILY"; import { HR_PERSONAL_OFFICER_FAMILY } from "../entities/mis/HR_PERSONAL_OFFICER_FAMILY";
const BATCH_SIZE = 1000; const BATCH_SIZE = 1000;
// import { EducationMis } from "../entities/EducationMis"; // import { EducationMis } from "../entities/EducationMis";
import { EducationMis } from "../entities/EducationMis"; import { EducationMis } from "../entities/mis/EducationMis";
import { ProvinceImport } from "../entities/ProvinceImport"; import { ProvinceImport } from "../entities/mis/ProvinceImport";
import { AmphurImport } from "../entities/AmphurImport"; import { AmphurImport } from "../entities/mis/AmphurImport";
import { SubDistrictImport } from "../entities/SubDistrictImport"; import { SubDistrictImport } from "../entities/mis/SubDistrictImport";
import { Province } from "../entities/Province"; import { Province } from "../entities/Province";
import { District } from "../entities/District"; import { District } from "../entities/District";
import { SubDistrict } from "../entities/SubDistrict"; import { SubDistrict } from "../entities/SubDistrict";
import { HR_EDUCATION } from "../entities/HR_EDUCATION"; import { HR_EDUCATION } from "../entities/mis/HR_EDUCATION";
import { HR_PERSONAL_OFFICER_ADDRESS } from "../entities/HR_PERSONAL_OFFICER_ADDRESS"; import { HR_PERSONAL_OFFICER_ADDRESS } from "../entities/mis/HR_PERSONAL_OFFICER_ADDRESS";
import { HR_EDUCATION_EMP } from "../entities/HR_EDUCATION_EMP"; import { HR_EDUCATION_EMP } from "../entities/mis/HR_EDUCATION_EMP";
import { HR_PERSONAL_EMP_ADDRESS } from "../entities/HR_PERSONAL_EMP_ADDRESS"; import { HR_PERSONAL_EMP_ADDRESS } from "../entities/mis/HR_PERSONAL_EMP_ADDRESS";
import { HR_PERSONAL_EMP_FAMILY } from "../entities/HR_PERSONAL_EMP_FAMILY"; import { HR_PERSONAL_EMP_FAMILY } from "../entities/mis/HR_PERSONAL_EMP_FAMILY";
import { OrgRoot } from "../entities/OrgRoot"; import { OrgRoot } from "../entities/OrgRoot";
import { OrgChild1 } from "../entities/OrgChild1"; import { OrgChild1 } from "../entities/OrgChild1";
import { OrgChild2 } from "../entities/OrgChild2"; import { OrgChild2 } from "../entities/OrgChild2";
import { OrgChild3 } from "../entities/OrgChild3"; import { OrgChild3 } from "../entities/OrgChild3";
import { OrgChild4 } from "../entities/OrgChild4"; import { OrgChild4 } from "../entities/OrgChild4";
import { IMPORT_ORG } from "../entities/IMPORT_ORG"; import { IMPORT_ORG } from "../entities/mis/IMPORT_ORG";
import { OrgRevision } from "../entities/OrgRevision"; import { OrgRevision } from "../entities/OrgRevision";
import { OFFICER } from "../entities/OFFICER"; import { OFFICER } from "../entities/mis/OFFICER";
import { Position } from "../entities/Position"; import { Position } from "../entities/Position";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
import { positionOfficer } from "../entities/positionOfficer";
import { PosExecutive } from "../entities/PosExecutive"; import { PosExecutive } from "../entities/PosExecutive";
import { EducationLevel } from "../entities/EducationLevel"; import { EducationLevel } from "../entities/EducationLevel";
import { HR_FUND_COURSE_CODE } from "../entities/HR_FUND_COURSE_CODE"; import { HR_FUND_COURSE_CODE } from "../entities/mis/HR_FUND_COURSE_CODE";
import { HR_MAJOR_CODE } from "../entities/HR_MAJOR_CODE"; import { HR_MAJOR_CODE } from "../entities/mis/HR_MAJOR_CODE";
// import { uuidv7 } from "uuidv7"; // import { uuidv7 } from "uuidv7";
import { ProfileSalaries } from "../entities/ProfileSalaries"; import { ProfileSalaries } from "../entities/mis/ProfileSalaries";
import { HR_POSITION_OFFICER } from "../entities/HR_POSITION_OFFICER"; import { HR_POSITION_OFFICER } from "../entities/mis/HR_POSITION_OFFICER";
import { EMPLOYEE } from "../entities/EMPLOYEE"; import { EMPLOYEE } from "../entities/mis/EMPLOYEE";
import { EmployeePosLevel } from "../entities/EmployeePosLevel"; import { EmployeePosLevel } from "../entities/EmployeePosLevel";
import { EmployeePosType } from "../entities/EmployeePosType"; import { EmployeePosType } from "../entities/EmployeePosType";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { EmployeePosition } from "../entities/EmployeePosition"; import { EmployeePosition } from "../entities/EmployeePosition";
import { HR_POSITION_EMPLOYEE } from "../entities/HR_POSITION_EMPLOYEE"; import { HR_POSITION_EMPLOYEE } from "../entities/mis/HR_POSITION_EMPLOYEE";
import { ProfileDiscipline } from "../entities/ProfileDiscipline"; import { ProfileDiscipline } from "../entities/ProfileDiscipline";
import { ProfileInsignia } from "../entities/ProfileInsignia"; import { ProfileInsignia } from "../entities/ProfileInsignia";
import { HR_DISCIPLINE_EMP } from "../entities/HR_DISCIPLINE_EMP"; import { HR_DISCIPLINE_EMP } from "../entities/mis/HR_DISCIPLINE_EMP";
import { HR_DISCIPLINE } from "../entities/HR_DISCIPLINE"; import { HR_DISCIPLINE } from "../entities/mis/HR_DISCIPLINE";
import { HR_INSIGNIA } from "../entities/HR_INSIGNIA"; import { HR_INSIGNIA } from "../entities/mis/HR_INSIGNIA";
import { HR_INSIGNIA_EMP } from "../entities/HR_INSIGNIA_EMP"; import { HR_INSIGNIA_EMP } from "../entities/mis/HR_INSIGNIA_EMP";
import { Insignia } from "../entities/Insignia"; import { Insignia } from "../entities/Insignia";
import { ProfileChildren } from "../entities/ProfileChildren"; import { ProfileChildren } from "../entities/ProfileChildren";
import { ProfileChangeName } from "../entities/ProfileChangeName"; import { ProfileChangeName } from "../entities/ProfileChangeName";
import { HR_CHILDEN } from "../entities/HR_CHILDEN"; import { HR_CHILDEN } from "../entities/mis/HR_CHILDEN";
import { HR_CHILDEN_EMP } from "../entities/HR_CHILDEN_EMP"; import { HR_CHILDEN_EMP } from "../entities/mis/HR_CHILDEN_EMP";
import { HR_CHANGENAME } from "../entities/HR_CHANGENAME"; import { HR_CHANGENAME } from "../entities/mis/HR_CHANGENAME";
import { HR_CHANGENAME_EMP } from "../entities/HR_CHANGENAME_EMP"; import { HR_CHANGENAME_EMP } from "../entities/mis/HR_CHANGENAME_EMP";
import { ProfileHonor } from "../entities/ProfileHonor"; import { ProfileHonor } from "../entities/ProfileHonor";
import { ProfileAbility } from "../entities/ProfileAbility"; import { ProfileAbility } from "../entities/ProfileAbility";
import { ProfileDuty } from "../entities/ProfileDuty"; import { ProfileDuty } from "../entities/ProfileDuty";
import { ProfileNopaid } from "../entities/ProfileNopaid"; import { ProfileNopaid } from "../entities/ProfileNopaid";
import { ProfileOther } from "../entities/ProfileOther"; import { ProfileOther } from "../entities/ProfileOther";
import { ProfileCertificate } from "../entities/ProfileCertificate"; import { ProfileCertificate } from "../entities/ProfileCertificate";
import { ProfileAbilitys } from "../entities/ProfileAbilitys"; import { ProfileAbilitys } from "../entities/mis/ProfileAbilitys";
import { ProfileCertificates } from "../entities/ProfileCertificates"; import { ProfileCertificates } from "../entities/mis/ProfileCertificates";
import { ProfileDutys } from "../entities/ProfileDutys"; import { ProfileDutys } from "../entities/mis/ProfileDutys";
import { ProfileHonors } from "../entities/ProfileHonors"; import { ProfileHonors } from "../entities/mis/ProfileHonors";
import { ProfileNopaids } from "../entities/ProfileNopaids"; import { ProfileNopaids } from "../entities/mis/ProfileNopaids";
import { ProfileOthers } from "../entities/ProfileOthers"; import { ProfileOthers } from "../entities/mis/ProfileOthers";
import { ProfileDisciplines } from "../entities/ProfileDisciplines"; import { ProfileDisciplines } from "../entities/mis/ProfileDisciplines";
import { ProfileChangeNames } from "../entities/ProfileChangeNames"; import { ProfileChangeNames } from "../entities/mis/ProfileChangeNames";
import { ProfileChildrens } from "../entities/ProfileChildrens"; import { ProfileChildrens } from "../entities/mis/ProfileChildrens";
import { ProfileEducations } from "../entities/ProfileEducations"; import { ProfileEducations } from "../entities/mis/ProfileEducations";
import { ProfileInsignias } from "../entities/ProfileInsignias"; import { ProfileInsignias } from "../entities/mis/ProfileInsignias";
import { ProfileLeave } from "../entities/ProfileLeave"; import { ProfileLeave } from "../entities/ProfileLeave";
import { ProfileLeaves } from "../entities/ProfileLeaves"; import { ProfileLeaves } from "../entities/mis/ProfileLeaves";
import { ProfileSalaryTemp } from "../entities/ProfileSalaryTemp"; import { ProfileSalaryTemp } from "../entities/ProfileSalaryTemp";
import { ProfileTraining } from "../entities/ProfileTraining"; import { ProfileTraining } from "../entities/ProfileTraining";
import { ProfileTrainings } from "../entities/ProfileTrainings"; import { ProfileTrainings } from "../entities/mis/ProfileTrainings";
import { EMPLOYEETEMP } from "../entities/EMPLOYEETEMP"; import { EMPLOYEETEMP } from "../entities/mis/EMPLOYEETEMP";
import { HR_CHANGENAME_EMPTEMP } from "../entities/HR_CHANGENAME_EMPTEMP"; import { HR_CHANGENAME_EMPTEMP } from "../entities/mis/HR_CHANGENAME_EMPTEMP";
import { HR_DISCIPLINE_EMPTEMP } from "../entities/HR_DISCIPLINE_EMPTEMP"; import { HR_DISCIPLINE_EMPTEMP } from "../entities/mis/HR_DISCIPLINE_EMPTEMP";
import { HR_EDUCATION_EMPTEMP } from "../entities/HR_EDUCATION_EMPTEMP"; import { HR_EDUCATION_EMPTEMP } from "../entities/mis/HR_EDUCATION_EMPTEMP";
import { HR_PERSONAL_EMPTEMP_ADDRESS } from "../entities/HR_PERSONAL_EMPTEMP_ADDRESS"; import { HR_PERSONAL_EMPTEMP_ADDRESS } from "../entities/mis/HR_PERSONAL_EMPTEMP_ADDRESS";
import { HR_PERSONAL_EMPTEMP_FAMILY } from "../entities/HR_PERSONAL_EMPTEMP_FAMILY"; import { HR_PERSONAL_EMPTEMP_FAMILY } from "../entities/mis/HR_PERSONAL_EMPTEMP_FAMILY";
import { HR_POSITION_EMPLOYEETEMP } from "../entities/HR_POSITION_EMPLOYEETEMP"; import { HR_POSITION_EMPLOYEETEMP } from "../entities/mis/HR_POSITION_EMPLOYEETEMP";
import { positionOfficer } from "../entities/mis/positionOfficer";
@Route("api/v1/org/upload") @Route("api/v1/org/upload")
@Tags("UPLOAD") @Tags("UPLOAD")
@Security("bearerAuth") @Security("bearerAuth")

View file

@ -1149,7 +1149,7 @@ export class ProfileController extends Controller {
where: { where: {
profileId: id, profileId: id,
commandCode: In(["5", "6"]), commandCode: In(["5", "6"]),
isEntry: false, // isEntry: false,
}, },
order: { order: "ASC" }, order: { order: "ASC" },
}); });
@ -1317,15 +1317,11 @@ export class ProfileController extends Controller {
.createQueryBuilder("profileLeave") .createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType") .leftJoinAndSelect("profileLeave.leaveType", "leaveType")
.select([ .select([
"profileLeave.leaveTypeId", "profileLeave.dateLeaveStart AS dateLeaveStart",
"profileLeave.dateLeaveStart", "profileLeave.dateLeaveEnd AS dateLeaveEnd",
"profileLeave.dateLeaveEnd", "profileLeave.leaveDays AS leaveDays",
"leaveType.name as name", "profileLeave.reason AS reason",
"leaveType.code as code", "leaveType.name as name"
"profileLeave.status",
"profileLeave.profileId",
"profileLeave.leaveDays",
"profileLeave.reason",
]) ])
.where("profileLeave.profileId = :profileId", { profileId: id }) .where("profileLeave.profileId = :profileId", { profileId: id })
.andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] }) .andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] })
@ -1335,13 +1331,12 @@ export class ProfileController extends Controller {
const leaves2 = const leaves2 =
leave2_raw.length > 0 leave2_raw.length > 0
? leave2_raw.map((item) => ({ ? leave2_raw.map((item) => ({
date: item.dateLeaveStart date: item.dateLeaveStart && item.dateLeaveEnd
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) + " - "
: item.dateLeaveEnd + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd))
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd)) : "-",
: "",
type: item.name || "-", type: item.name || "-",
leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays) : "-", leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "-",
reason: item.reason || "-", reason: item.reason || "-",
})) }))
: [ : [
@ -1611,7 +1606,7 @@ export class ProfileController extends Controller {
where: { where: {
profileId: id, profileId: id,
commandCode: "7", commandCode: "7",
isEntry: false, // isEntry: false,
}, },
order: { order: "ASC" }, order: { order: "ASC" },
}); });
@ -1688,6 +1683,25 @@ export class ProfileController extends Controller {
(profiles.currentZipCode ? " " + profiles.currentZipCode : ""), (profiles.currentZipCode ? " " + profiles.currentZipCode : ""),
) )
: ""; : "";
let portfolios:any
await new CallAPI()
.GetData(req, `/development/portfolio/kk1/${profiles?.keycloak}`)
.then((x) => {
portfolios = x;
})
.catch(() => {});
if (!portfolios) {
portfolios = [{ name: "-", year: "-" }]
}
else {
portfolios = portfolios.map((x:any) => ({
name: x.name ? x.name : "-",
year: x.year ? Extension.ToThaiNumber(x.year.toString()) : "-"
}))
}
const data = { const data = {
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`, fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
prefix: profiles?.prefix != null ? profiles.prefix : "", prefix: profiles?.prefix != null ? profiles.prefix : "",
@ -1841,6 +1855,7 @@ export class ProfileController extends Controller {
assessments, assessments,
profileAbility, profileAbility,
otherIncome, otherIncome,
portfolios
}; };
return new HttpSuccess({ return new HttpSuccess({

View file

@ -205,6 +205,9 @@ export class ProfileDevelopmentController extends Controller {
const data = new ProfileDevelopment(); const data = new ProfileDevelopment();
const meta = { const meta = {
isDevelopment10: body.isDevelopment10 ?? false,
isDevelopment20: body.isDevelopment20 ?? false,
isDevelopment70: body.isDevelopment70 ?? false,
createdUserId: req.user.sub, createdUserId: req.user.sub,
createdFullName: req.user.name, createdFullName: req.user.name,
lastUpdateUserId: req.user.sub, lastUpdateUserId: req.user.sub,

View file

@ -10,6 +10,7 @@ import {
Route, Route,
Security, Security,
Tags, Tags,
Query
} from "tsoa"; } from "tsoa";
import { AppDataSource } from "../database/data-source"; import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
@ -25,6 +26,7 @@ import {
} from "../entities/ProfileDevelopment"; } from "../entities/ProfileDevelopment";
import permission from "../interfaces/permission"; import permission from "../interfaces/permission";
import { DevelopmentProject } from "../entities/DevelopmentProject"; import { DevelopmentProject } from "../entities/DevelopmentProject";
import { In, Brackets } from "typeorm";
@Route("api/v1/org/profile-employee/development") @Route("api/v1/org/profile-employee/development")
@Tags("ProfileDevelopment") @Tags("ProfileDevelopment")
@Security("bearerAuth") @Security("bearerAuth")
@ -48,15 +50,60 @@ export class ProfileDevelopmentEmployeeController extends Controller {
} }
@Get("{profileId}") @Get("{profileId}")
public async getDevelopment(@Path() profileId: string, @Request() req: RequestWithUser) { public async getDevelopment(
@Path() profileId: string,
@Request() req: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query() searchKeyword: string = "",
) {
let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP"); let _workflow = await new permission().Workflow(req, profileId, "SYS_REGISTRY_EMP");
if (_workflow == false) if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId); await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
const lists = await this.developmentRepository.find({ const [profileDevelopment, total] = await AppDataSource.getRepository(ProfileDevelopment)
where: { profileEmployeeId: profileId }, .createQueryBuilder("profileDevelopment")
order: { createdAt: "ASC" }, .where({ profileEmployeeId: profileId })
}); .andWhere(
return new HttpSuccess(lists); new Brackets((qb) => {
qb.where(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.name LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
)
.orWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.developmentTarget LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
)
.orWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.developmentResults LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
)
.orWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? "profileDevelopment.developmentReport LIKE :keyword"
: "1=1",
{
keyword: `%${searchKeyword}%`,
},
);
}),
)
.orderBy("profileDevelopment.createdAt", "ASC")
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
return new HttpSuccess({ data: profileDevelopment, total });
} }
@Get("history/{developmentId}") @Get("history/{developmentId}")
@ -96,6 +143,9 @@ export class ProfileDevelopmentEmployeeController extends Controller {
const data = new ProfileDevelopment(); const data = new ProfileDevelopment();
const meta = { const meta = {
isDevelopment10: body.isDevelopment10 ?? false,
isDevelopment20: body.isDevelopment20 ?? false,
isDevelopment70: body.isDevelopment70 ?? false,
createdUserId: req.user.sub, createdUserId: req.user.sub,
createdFullName: req.user.name, createdFullName: req.user.name,
lastUpdateUserId: req.user.sub, lastUpdateUserId: req.user.sub,

View file

@ -1144,7 +1144,7 @@ export class ProfileEmployeeController extends Controller {
where: { where: {
profileEmployeeId: id, profileEmployeeId: id,
commandCode: In(["5", "6"]), commandCode: In(["5", "6"]),
isEntry: false, // isEntry: false,
}, },
order: { order: "ASC" }, order: { order: "ASC" },
}); });
@ -1310,15 +1310,11 @@ export class ProfileEmployeeController extends Controller {
.createQueryBuilder("profileLeave") .createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType") .leftJoinAndSelect("profileLeave.leaveType", "leaveType")
.select([ .select([
"profileLeave.leaveTypeId", "profileLeave.dateLeaveStart AS dateLeaveStart",
"profileLeave.dateLeaveStart", "profileLeave.dateLeaveEnd AS dateLeaveEnd",
"profileLeave.dateLeaveEnd", "profileLeave.leaveDays AS leaveDays",
"leaveType.name as name", "profileLeave.reason AS reason",
"leaveType.code as code", "leaveType.name as name"
"profileLeave.status",
"profileLeave.profileEmployeeId",
"profileLeave.leaveDays",
"profileLeave.reason",
]) ])
.where("profileLeave.profileEmployeeId = :profileId", { profileId: id }) .where("profileLeave.profileEmployeeId = :profileId", { profileId: id })
.andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] }) .andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] })
@ -1328,13 +1324,12 @@ export class ProfileEmployeeController extends Controller {
const leaves2 = const leaves2 =
leave2_raw.length > 0 leave2_raw.length > 0
? leave2_raw.map((item) => ({ ? leave2_raw.map((item) => ({
date: item.dateLeaveStart date: item.dateLeaveStart && item.dateLeaveEnd
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) + " - "
: item.dateLeaveEnd + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd))
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd)) : "-",
: "",
type: item.name || "-", type: item.name || "-",
leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays) : "-", leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "-",
reason: item.reason || "-", reason: item.reason || "-",
})) }))
: [ : [
@ -1601,7 +1596,7 @@ export class ProfileEmployeeController extends Controller {
where: { where: {
profileEmployeeId: id, profileEmployeeId: id,
commandCode: "7", commandCode: "7",
isEntry: false, // isEntry: false,
}, },
order: { order: "ASC" }, order: { order: "ASC" },
}); });

View file

@ -47,9 +47,7 @@ export const AppDataSource = new DataSource({
logging: true, logging: true,
// timezone: "Z", // timezone: "Z",
entities: entities:
process.env.NODE_ENV !== "production" process.env.NODE_ENV !== "production" ? ["src/entities/*.ts"] : ["dist/entities/*{.ts,.js}"],
? ["src/entities/**/*.ts"]
: ["dist/entities/**/*{.ts,.js}"],
migrations: migrations:
process.env.NODE_ENV !== "production" process.env.NODE_ENV !== "production"
? ["src/migration/**/*.ts"] ? ["src/migration/**/*.ts"]

View file

@ -77,8 +77,8 @@ export class ProfileAbility extends EntityBase {
profileEmployeeId: string; profileEmployeeId: string;
@Column({ @Column({
nullable: false,
comment: "ข้อมูลจาก Entry", comment: "ข้อมูลจาก Entry",
default: false,
}) })
isEntry: boolean; isEntry: boolean;

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("amphurImport") @Entity("amphurImport")
export class AmphurImport extends EntityBase { export class AmphurImport extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("educationMis") @Entity("educationMis")
export class EducationMis extends EntityBase { export class EducationMis extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileAbilitys") @Entity("ProfileAbilitys")
export class ProfileAbilitys extends EntityBase { export class ProfileAbilitys extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileCertificates") @Entity("ProfileCertificates")
export class ProfileCertificates extends EntityBase { export class ProfileCertificates extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileChangeNames") @Entity("ProfileChangeNames")
export class ProfileChangeNames extends EntityBase { export class ProfileChangeNames extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Column, Entity } from "typeorm"; import { Column, Entity } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileChildrens") @Entity("ProfileChildrens")
export class ProfileChildrens extends EntityBase { export class ProfileChildrens extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileDisciplines") @Entity("ProfileDisciplines")
export class ProfileDisciplines extends EntityBase { export class ProfileDisciplines extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileDutys") @Entity("ProfileDutys")
export class ProfileDutys extends EntityBase { export class ProfileDutys extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileEducations") @Entity("ProfileEducations")
export class ProfileEducations extends EntityBase { export class ProfileEducations extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileHonors") @Entity("ProfileHonors")
export class ProfileHonors extends EntityBase { export class ProfileHonors extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileInsignias") @Entity("ProfileInsignias")
export class ProfileInsignias extends EntityBase { export class ProfileInsignias extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileLeaveSummary") @Entity("ProfileLeaveSummary")
export class ProfileLeaves extends EntityBase { export class ProfileLeaves extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileNopaids") @Entity("ProfileNopaids")
export class ProfileNopaids extends EntityBase { export class ProfileNopaids extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileOthers") @Entity("ProfileOthers")
export class ProfileOthers extends EntityBase { export class ProfileOthers extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column, Double } from "typeorm"; import { Entity, Column, Double } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileSalaries") @Entity("ProfileSalaries")
export class ProfileSalaries extends EntityBase { export class ProfileSalaries extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("ProfileTrainings") @Entity("ProfileTrainings")
export class ProfileTrainings extends EntityBase { export class ProfileTrainings extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("provinceImport") @Entity("provinceImport")
export class ProvinceImport extends EntityBase { export class ProvinceImport extends EntityBase {

View file

@ -1,5 +1,5 @@
import { Entity, Column } from "typeorm"; import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "../base/Base";
@Entity("subDistrictImport") @Entity("subDistrictImport")
export class SubDistrictImport extends EntityBase { export class SubDistrictImport extends EntityBase {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,34 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Update2107202611411754401420685 implements MigrationInterface {
name = 'Update2107202611411754401420685'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`posNo\` varchar(255) NULL COMMENT 'เลขที่ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`birthDateOld\` datetime NULL COMMENT 'วันเกิดเดิม โดยจะบันทึกเมื่อมีการแก้ไขข้อมูลส่วนตัว'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`birthDateOld\` datetime NULL COMMENT 'วันเกิดเดิม โดยจะบันทึกเมื่อมีการแก้ไขข้อมูลส่วนตัว'`);
await queryRunner.query(`ALTER TABLE \`profileTraining\` CHANGE \`isEntry\` \`isEntry\` tinyint NOT NULL COMMENT 'ข้อมูลจาก Entry' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` CHANGE \`createdFullName\` \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'System Administrator'`);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` CHANGE \`lastUpdateFullName\` \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'System Administrator'`);
await queryRunner.query(`ALTER TABLE \`metaWorkflow\` CHANGE \`createdFullName\` \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'System Administrator'`);
await queryRunner.query(`ALTER TABLE \`metaWorkflow\` CHANGE \`lastUpdateFullName\` \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'System Administrator'`);
await queryRunner.query(`ALTER TABLE \`metaState\` CHANGE \`createdFullName\` \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'System Administrator'`);
await queryRunner.query(`ALTER TABLE \`metaState\` CHANGE \`lastUpdateFullName\` \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'System Administrator'`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD CONSTRAINT \`FK_f1ded3e1f83ab2437f739a14f38\` FOREIGN KEY (\`profileSalaryId\`) REFERENCES \`profileSalary\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP FOREIGN KEY \`FK_f1ded3e1f83ab2437f739a14f38\``);
await queryRunner.query(`ALTER TABLE \`metaState\` CHANGE \`lastUpdateFullName\` \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`metaState\` CHANGE \`createdFullName\` \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`metaWorkflow\` CHANGE \`lastUpdateFullName\` \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`metaWorkflow\` CHANGE \`createdFullName\` \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` CHANGE \`lastUpdateFullName\` \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`metaStateOperator\` CHANGE \`createdFullName\` \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string'`);
await queryRunner.query(`ALTER TABLE \`profileTraining\` CHANGE \`isEntry\` \`isEntry\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`birthDateOld\``);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`birthDateOld\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`posNo\``);
}
}