add dpis controller

This commit is contained in:
Suphonchai Phoonsawat 2024-10-07 14:53:27 +07:00
parent 497decefe4
commit 4852131651
74 changed files with 606 additions and 336 deletions

View file

@ -1,18 +1,23 @@
AUTH_REALM_URL=http://192.168.1.200:8080/realms/dev AUTH_REALM_URL=https://id.frappet.synology.me/realms/bma-ehr
AUTH_PUBLIC_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1/QAH75nWgiRzWCTrGJv8q2A7z0qggC2IQ9Sva/Ok1RxeGE/ED2m4ELbF5B9MtugyXYGMUBXaKhooMpTE3wyR1OwsUlv/GtYSmMuKUnsSEXklsP8nIq8gZkCvISOVdvIC4ng5aZ5nBcp9cQ3eVbz4dfZcbLzcqLIIkxQmFBK0m1eFL5IdNj8Ac7U4eH4ylOckOu174f35NnFH6wDva6Iic3EXapMcE2BnXXCTajk2dmlWAzH13ybQBgHDfrOtulrmn1CzQxe9WUJes4qX5z72N05KsHvtUObaeN6cb+mIeH36GdysqgAdd2hhKkgUFXwtLPzldtrEc7xVyf3OLEg1QIDAQAB AUTH_PUBLIC_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvYg0ZJvH6HgNOzyPp7PCvY3bJwD9WdsNn6gZbuvIfqJQZ8iSH1t0p3fgODO/fqwcj9UFeh1bVFOSjuW+JpnPehROqzt81KNl9zLLNXoN4LimReQHaMM3dU7DCbRylgVCouIDvObyjg8G+Cy5lZvFKWym/DPwGVpSdbvDZJ83qxq2dp7GJXS8PhOvA+MB1K009/jW5pBTUwNArLjoFccr+gIYIiOJDg2rYyIF3fDkwyWkuxr6xRt10+BRJytselwy/18kbDuJxVPaapdgTXI6wLzx7HWcDk30n5EvhJEumnIPpRst8gucqNYmB4MH+vsyoxV5WLuO3qmVRzFbtAppRQIDAQAB
AUTH_PREFERRED_MODE=online AUTH_PREFERRED_MODE=online
AUTH_ACCOUNT_SECRET=qsFwDb5anVoXKKwoeivrByIn9VYWQNRn
APP_HOST=0.0.0.0 APP_HOST=0.0.0.0
APP_PORT=3000 APP_PORT=13001
DB_HOST=192.168.1.80
DB_HOST=192.168.1.200
DB_PORT=3306 DB_PORT=3306
DB_USERNAME=root DB_USERNAME=root
DB_PASSWORD= DB_PASSWORD=adminVM123
DB_NAME=dev DB_NAME=bma_ehr_organization_demo
KC_URL=https://id.frappet.synology.me
KC_URL=http://192.168.1.50:8080 KC_REALM=bma-ehr
KC_REALM=dev KC_SERVICE_ACCOUNT_CLIENT_ID=bma-ehr-dev
KC_SERVICE_ACCOUNT_CLIENT_ID=dev-service KC_SERVICE_ACCOUNT_SECRET=f2mp7Xj4nz6gbgITve9J7AHXZI8dRhOd
KC_SERVICE_ACCOUNT_SECRET= API_URL=https://bma-ehr.frappet.synology.me/api/v1
MANAGEMENT_ROLE=storage_management REDIS_HOST=192.168.1.81
REDIS_PORT=6379
ELASTICSEARCH_INDEX=bma-ehr-log-index
ELASTICSEARCH_PROTOCOL=http
ELASTICSEARCH_HOST=192.168.1.40
ELASTICSEARCH_PORT=9200
API_KEY=fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz

View file

@ -37,13 +37,13 @@ All notable changes to this project will be documented in this file.
### 🚜 Refactor ### 🚜 Refactor
- *(utils)* Merge 2 statement of same conditions - _(utils)_ Merge 2 statement of same conditions
- *(middlewares)* Add type to function parameter auth role - _(middlewares)_ Add type to function parameter auth role
- History in database after first edit only - History in database after first edit only
### ⚙️ Miscellaneous Tasks ### ⚙️ Miscellaneous Tasks
- *(tsoa-setting)* Update to recursive path - _(tsoa-setting)_ Update to recursive path
- Add response example - Add response example
## [1.0.61] - 2024-03-11 ## [1.0.61] - 2024-03-11

View file

@ -0,0 +1,253 @@
import {
Controller,
Example,
Get,
Path,
Response,
Route,
Security,
SuccessResponse,
Tags,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import { Profile } from "../entities/Profile";
import HttpError from "../interfaces/http-error";
import HttpStatus from "../interfaces/http-status";
import HttpSuccess from "../interfaces/http-success";
@Route("api/v1/dpis")
@Tags("DPIS")
@Security("bearerAuth")
@Response(
HttpStatus.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatus.OK, "สำเร็จ")
export class DPISController extends Controller {
private profileRepo = AppDataSource.getRepository(Profile);
/**
* 1. API Get Profile
*
* @summary 1. API Get Profile
*
* @param {string} citizenId
*
* @returns
*/
@Get("{citizenId}")
@Example({
id: "08dc4c9f-2710-4e98-8340-c9f2a65467db",
avatar: null,
avatarName: null,
rank: null,
prefix: "นาย",
firstName: "สุรศักดิ์",
lastName: "จันทร์ศรี",
citizenId: "1103700765894",
position: "เจ้าพนักงานสาธารณสุข",
posLevelId: "1526d9d3-d8b1-43ab-81b5-a84dfbe08262",
email: "userUat43@test.test",
phone: null,
keycloak: "bac99314-8163-4671-9af6-cf994167e939",
isProbation: false,
isLeave: false,
leaveReason: null,
dateRetire: "2055-05-06T17:00:00.000Z",
dateAppoint: "2022-11-24T17:00:00.000Z",
dateRetireLaw: "2055-09-29T17:00:00.000Z",
dateStart: "2022-11-24T17:00:00.000Z",
govAgeAbsent: 0,
govAgePlus: 0,
birthDate: "1995-05-06T17:00:00.000Z",
reasonSameDate: null,
telephoneNumber: "990686659",
nationality: "ไทย",
gender: "หญิง",
relationship: "โสด",
religion: "พุทธ",
bloodGroup: null,
registrationAddress: "21/1 หมู่ที่ 2",
registrationProvinceId: "24bf701c-33d6-436e-ad49-6f82bb3ae029",
registrationDistrictId: "34bf701c-33d6-436e-ad49-6f82bb3b0642",
registrationSubDistrictId: "44bf701c-33d6-436e-ad49-6f82bb3b3427",
registrationZipCode: "22110",
currentAddress: "21/1 หมู่ที่ 2",
currentProvinceId: "24bf701c-33d6-436e-ad49-6f82bb3ae029",
currentSubDistrictId: "44bf701c-33d6-436e-ad49-6f82bb3b3427",
currentZipCode: "22110",
dutyTimeId: null,
dutyTimeEffectiveDate: null,
posLevel: {
id: "1526d9d3-d8b1-43ab-81b5-a84dfbe08262",
createdAt: "2024-01-26T05:42:53.761Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-01-26T05:42:53.761Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "สาวิตรี ศรีสมัย",
posLevelName: "ปฏิบัติงาน",
posLevelRank: 1,
posLevelAuthority: null,
posTypeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe08061",
},
posType: {
id: "1526d9d3-d8b1-43ab-81b5-a84dfbe08061",
createdAt: "2024-01-26T05:42:53.761Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-08-25T09:41:14.000Z",
lastUpdateUserId: "01378019-5286-4e1d-ae43-826b648af4aa",
createdFullName: "สาวิตรี ศรีสมัย",
lastUpdateFullName: "Super Admin",
posTypeName: "ทั่วไป",
posTypeRank: 1,
},
profileSalary: [
{
id: "eef6d0b6-ef64-4389-b497-c74a62e5f334",
createdAt: "2024-08-22T02:23:57.193Z",
createdUserId: "94ba986d-f871-46a2-be92-46c0cbf0bc56",
lastUpdatedAt: "2024-08-22T02:23:57.193Z",
lastUpdateUserId: "94ba986d-f871-46a2-be92-46c0cbf0bc56",
createdFullName: "กานต์พิชชา นาคศรี",
lastUpdateFullName: "กานต์พิชชา นาคศรี",
profileId: "08dc4c9f-2710-4e98-8340-c9f2a65467db",
profileEmployeeId: null,
date: "2024-08-22T09:23:18.000Z",
posNo: "ขพน.65",
position: "เจ้าพนักงานสาธารณสุข",
positionLine: "ปฏิบัติงานสาธารณสุข",
positionPathSide: null,
positionExecutive: null,
positionType: "ทั่วไป",
positionLevel: "ปฏิบัติงาน",
amount: 11860,
positionSalaryAmount: 0,
mouthSalaryAmount: 0,
refCommandNo: null,
templateDoc: "ปรับโครงสร้าง",
order: 3,
},
{
id: "916fcf0c-f0d5-4efb-af46-0f1942de5c19",
createdAt: "2024-06-27T22:01:25.959Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-06-27T23:24:50.219Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "โกศล สิงหนาท",
lastUpdateFullName: "โกศล สิงหนาท",
profileId: "08dc4c9f-2710-4e98-8340-c9f2a65467db",
profileEmployeeId: null,
date: "2023-03-31T17:00:00.000Z",
posNo: "ขพน.65",
position:
"เจ้าพนักงานสาธารณสุขปฏิบัติงาน ฝ่ายสิ่งแวดล้อมและสุขาภิบาล สำนักงานเขตพระนคร\n(ทดลองปฏิบัติหน้าที่ราชการ)",
positionLine: null,
positionPathSide: null,
positionExecutive: null,
positionType: "ทั่วไป",
positionLevel: "ปฏิบัติงาน",
amount: 11860,
positionSalaryAmount: 0,
mouthSalaryAmount: 0,
refCommandNo: null,
templateDoc: "เลื่อนขั้นเงินเดือน คำสั่ง ขพน.ที่ 159/2566 ลว. 6 มิ.ย. 2566",
order: 2,
},
{
id: "161bea25-0451-4eff-bbfd-709e88a1700f",
createdAt: "2024-06-27T22:01:25.881Z",
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
lastUpdatedAt: "2024-06-27T23:24:50.219Z",
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
createdFullName: "โกศล สิงหนาท",
lastUpdateFullName: "โกศล สิงหนาท",
profileId: "08dc4c9f-2710-4e98-8340-c9f2a65467db",
profileEmployeeId: null,
date: "2022-11-24T17:00:00.000Z",
posNo: "ขพน.65",
position:
"เจ้าพนักงานสาธารณสุขปฏิบัติงาน ฝ่ายสิ่งแวดล้อมและสุขาภิบาล สำนักงานเขตพระนคร\n(ทดลองปฏิบัติหน้าที่ราชการ)",
positionLine: null,
positionPathSide: null,
positionExecutive: null,
positionType: "ทั่วไป",
positionLevel: "ปฏิบัติงาน",
amount: 11500,
positionSalaryAmount: 0,
mouthSalaryAmount: 0,
refCommandNo: null,
templateDoc:
"บรรจุและแต่งตั้งผู้สอบแข่งขันได้ คำสั่ง ขพน.ที่ 374/2565 ลว. 29 พ.ย. 2565 โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า 5 ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง \nโดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นแต่ลาออกจากราชการ\n",
order: 1,
},
],
profileInsignia: [],
})
async GetProfileCitizenIdAsync(@Path() citizenId: string) {
const profile = await this.profileRepo.findOne({
relations: {
posLevel: true,
posType: true,
profileSalary: true,
profileInsignias: true,
profileEducations: true,
},
where: { citizenId: citizenId },
order: {
profileSalary: {
date: "DESC",
},
profileInsignias: {
receiveDate: "DESC",
},
profileEducations: {
degree: "ASC",
},
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const mapProfile = {
citizenId: profile.citizenId,
prefix: profile.prefix,
firstName: profile.firstName,
lastName: profile.lastName,
rank: profile.rank,
position: profile.position,
isProbation: profile.isProbation,
isLeave: profile.isLeave,
leaveReason: profile.leaveReason,
dateRetire: profile.dateRetire,
dateAppoint: profile.dateAppoint,
dateRetireLaw: profile.dateRetireLaw,
dateStart: profile.dateStart,
birthDate: profile.birthDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId,
registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId,
currentSubDistrictId: profile.currentSubDistrictId,
currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary,
profileInsignia: profile.profileInsignias,
profileEducation: profile.profileEducations,
};
return new HttpSuccess(mapProfile);
}
}

View file

@ -230,19 +230,15 @@ export class InsigniaController extends Controller {
path = path.toLocaleUpperCase(); path = path.toLocaleUpperCase();
let getPermission: string = ""; let getPermission: string = "";
if (path == "MANAGE") { if (path == "MANAGE") {
getPermission = "SYS_INSIGNIA_MANAGE" getPermission = "SYS_INSIGNIA_MANAGE";
} } else if (path == "RECORD") {
else if(path == "RECORD") { getPermission = "SYS_INSIGNIA_RECORD";
getPermission = "SYS_INSIGNIA_RECORD" } else if (path == "ALLOCATE") {
} getPermission = "SYS_INSIGNIA_ALLOCATE";
else if(path == "ALLOCATE") { } else if (path == "BORROW") {
getPermission = "SYS_INSIGNIA_ALLOCATE" getPermission = "SYS_INSIGNIA_BORROW";
} } else {
else if(path == "BORROW") { getPermission = "SYS_INSIGNIA_MANAGE";
getPermission = "SYS_INSIGNIA_BORROW"
}
else {
getPermission = "SYS_INSIGNIA_MANAGE"
} }
await new permission().PermissionList(request, getPermission); await new permission().PermissionList(request, getPermission);
const insigniaAll = await this.insigniaRepository.find({ const insigniaAll = await this.insigniaRepository.find({

View file

@ -203,16 +203,13 @@ export class InsigniaTypeController extends Controller {
path = path.toLocaleUpperCase(); path = path.toLocaleUpperCase();
let getPermission: string = ""; let getPermission: string = "";
if (path == "RECORD") { if (path == "RECORD") {
getPermission = "SYS_INSIGNIA_RECORD" getPermission = "SYS_INSIGNIA_RECORD";
} } else if (path == "ALLOCATE") {
else if(path == "ALLOCATE") { getPermission = "SYS_INSIGNIA_ALLOCATE";
getPermission = "SYS_INSIGNIA_ALLOCATE" } else if (path == "BORROW") {
} getPermission = "SYS_INSIGNIA_BORROW";
else if(path == "BORROW") { } else {
getPermission = "SYS_INSIGNIA_BORROW" getPermission = "SYS_INSIGNIA_RECORD";
}
else {
getPermission = "SYS_INSIGNIA_RECORD"
} }
await new permission().PermissionList(request, getPermission); await new permission().PermissionList(request, getPermission);
const insigniaTypeAll = await this.insigniaTypeRepository.find({ const insigniaTypeAll = await this.insigniaTypeRepository.find({

View file

@ -143,7 +143,8 @@ export class OrganizationDotnetController extends Controller {
const rootName = const rootName =
item.current_holders.length == 0 item.current_holders.length == 0
? null ? null
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot?.orgRootName; : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
?.orgRootName;
const shortName = const shortName =
item.current_holders.length == 0 item.current_holders.length == 0
? null ? null
@ -152,8 +153,8 @@ export class OrganizationDotnetController extends Controller {
null null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}` ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null && : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3 != item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
null ?.orgChild3 != null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}` ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null && : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
@ -222,9 +223,9 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: item.currentZipCode, currentZipCode: item.currentZipCode,
posLevel: item.posLevel, posLevel: item.posLevel,
posType: item.posType, posType: item.posType,
posNo: shortName posNo: shortName,
} };
}) }),
); );
return new HttpSuccess(profileEmp_); return new HttpSuccess(profileEmp_);
} }
@ -910,7 +911,7 @@ export class OrganizationDotnetController extends Controller {
"current_holders.orgChild2", "current_holders.orgChild2",
"current_holders.orgChild3", "current_holders.orgChild3",
"current_holders.orgChild4", "current_holders.orgChild4",
"profileSalary" "profileSalary",
], ],
order: { order: {
profileSalary: { profileSalary: {
@ -928,7 +929,8 @@ export class OrganizationDotnetController extends Controller {
const rootName = const rootName =
item.current_holders.length == 0 item.current_holders.length == 0
? null ? null
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot?.orgRootName; : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot
?.orgRootName;
const shortName = const shortName =
item.current_holders.length == 0 item.current_holders.length == 0
? null ? null
@ -937,8 +939,8 @@ export class OrganizationDotnetController extends Controller {
null null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}` ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild4.orgChild4ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null && : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3 != item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
null ?.orgChild3 != null
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}` ? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgChild3.orgChild3ShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
: item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null && : item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) != null &&
item.current_holders.find((x) => x.orgRevisionId == findRevision?.id) item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)
@ -1008,12 +1010,10 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: item.currentZipCode, currentZipCode: item.currentZipCode,
dutyTimeId: item.dutyTimeId, dutyTimeId: item.dutyTimeId,
dutyTimeEffectiveDate: item.dutyTimeEffectiveDate, dutyTimeEffectiveDate: item.dutyTimeEffectiveDate,
positionLevel: item.profileSalary.length > 0 positionLevel: item.profileSalary.length > 0 ? item.profileSalary[0].positionLevel : null,
? item.profileSalary[0].positionLevel posNo: shortName,
: null, };
posNo: shortName }),
}
})
); );
return new HttpSuccess(profile_); return new HttpSuccess(profile_);

View file

@ -104,7 +104,7 @@ export class PrefixController extends Controller {
_prefix.createdAt = new Date(); _prefix.createdAt = new Date();
_prefix.lastUpdatedAt = new Date(); _prefix.lastUpdatedAt = new Date();
await this.prefixRepository.save(_prefix, { data: request }); await this.prefixRepository.save(_prefix, { data: request });
setLogDataDiff( request, { before, after: _prefix} ) setLogDataDiff(request, { before, after: _prefix });
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -94,9 +94,7 @@ export class ProfileAssessmentsController extends Controller {
} }
@Get("history/{assessmentId}") @Get("history/{assessmentId}")
public async getProfileAssessmentsHistory( public async getProfileAssessmentsHistory(@Path() assessmentId: string) {
@Path() assessmentId: string,
) {
const record = await this.profileAssessmentsHistoryRepository.find({ const record = await this.profileAssessmentsHistoryRepository.find({
where: { where: {
profileAssessmentId: assessmentId, profileAssessmentId: assessmentId,

View file

@ -75,7 +75,11 @@ export class ProfileAssessmentsEmployeeController extends Controller {
) { ) {
const _record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId }); const _record = await this.profileAssessmentsRepository.findOneBy({ id: assessmentId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", _record.profileEmployeeId); await new permission().PermissionOrgUserGet(
req,
"SYS_REGISTRY_EMP",
_record.profileEmployeeId,
);
} }
const record = await this.profileAssessmentsHistoryRepository.find({ const record = await this.profileAssessmentsHistoryRepository.find({
where: { where: {
@ -91,9 +95,7 @@ export class ProfileAssessmentsEmployeeController extends Controller {
} }
@Get("history/{assessmentId}") @Get("history/{assessmentId}")
public async getProfileAssessmentsHistory( public async getProfileAssessmentsHistory(@Path() assessmentId: string) {
@Path() assessmentId: string,
) {
const record = await this.profileAssessmentsHistoryRepository.find({ const record = await this.profileAssessmentsHistoryRepository.find({
where: { where: {
profileAssessmentId: assessmentId, profileAssessmentId: assessmentId,

View file

@ -150,7 +150,6 @@ export class ProfileAvatarController extends Controller {
} }
await this.avatarRepository.remove(_record, { data: req }); await this.avatarRepository.remove(_record, { data: req });
return new HttpSuccess(); return new HttpSuccess();
} }
} }

View file

@ -57,7 +57,10 @@ export class ProfileCertificateEmployeeTempController extends Controller {
} }
@Get("admin/history/{certificateId}") @Get("admin/history/{certificateId}")
public async certificateAdminHistory(@Path() certificateId: string, @Request() req: RequestWithUser) { public async certificateAdminHistory(
@Path() certificateId: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.certificateHistoryRepo.find({ const record = await this.certificateHistoryRepo.find({
where: { where: {

View file

@ -103,7 +103,7 @@ export class ProfileChangeNameController extends Controller {
await this.changeNameRepository.save(data); await this.changeNameRepository.save(data);
history.profileChangeNameId = data.id; history.profileChangeNameId = data.id;
await this.changeNameHistoryRepository.save(history, { data: req }); await this.changeNameHistoryRepository.save(history, { data: req });
setLogDataDiff( req, { before, after: history }) setLogDataDiff(req, { before, after: history });
profile.firstName = body.firstName ?? profile.firstName; profile.firstName = body.firstName ?? profile.firstName;
profile.lastName = body.lastName ?? profile.lastName; profile.lastName = body.lastName ?? profile.lastName;
profile.prefix = body.prefix ?? profile.prefix; profile.prefix = body.prefix ?? profile.prefix;

View file

@ -405,7 +405,7 @@ export class ProfileGovernmentHistoryController extends Controller {
await Promise.all([ await Promise.all([
this.profileRepo.save(record, { data: req }), this.profileRepo.save(record, { data: req }),
setLogDataDiff(req, { before, after: record }), setLogDataDiff(req, { before, after: record }),
this.govRepo.save(history, { data:req }) this.govRepo.save(history, { data: req }),
]); ]);
return new HttpSuccess(); return new HttpSuccess();

View file

@ -388,7 +388,8 @@ export class ProfileGovernmentEmployeeController extends Controller {
await Promise.all([ await Promise.all([
this.profileEmployeeRepo.save(record, { data: req }), this.profileEmployeeRepo.save(record, { data: req }),
setLogDataDiff(req, { before, after: record }), setLogDataDiff(req, { before, after: record }),
this.govRepo.save(history, { data: req })]); this.govRepo.save(history, { data: req }),
]);
return new HttpSuccess(); return new HttpSuccess();
} }
} }

View file

@ -185,7 +185,7 @@ export class ProfileInsigniaController extends Controller {
await Promise.all([ await Promise.all([
this.insigniaRepo.save(record, { data: req }), this.insigniaRepo.save(record, { data: req }),
setLogDataDiff(req, { before, after: record }), setLogDataDiff(req, { before, after: record }),
this.insigniaHistoryRepo.save(history, { data: req }) this.insigniaHistoryRepo.save(history, { data: req }),
]); ]);
return new HttpSuccess(); return new HttpSuccess();

View file

@ -69,7 +69,10 @@ export class ProfileInsigniaEmployeeController extends Controller {
} }
@Get("admin/history/{InsigniaId}") @Get("admin/history/{InsigniaId}")
public async getInsigniaAdminHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) { public async getInsigniaAdminHistory(
@Path() InsigniaId: string,
@Request() req: RequestWithUser,
) {
const _record = await this.insigniaRepo.findOneBy({ id: InsigniaId }); const _record = await this.insigniaRepo.findOneBy({ id: InsigniaId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet( await new permission().PermissionOrgUserGet(
@ -146,7 +149,7 @@ export class ProfileInsigniaEmployeeController extends Controller {
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
await this.insigniaRepo.save(data, { data: req }); await this.insigniaRepo.save(data, { data: req });
setLogDataDiff( req, { before, after: data } ) setLogDataDiff(req, { before, after: data });
history.profileInsigniaId = data.id; history.profileInsigniaId = data.id;
await this.insigniaHistoryRepo.save(history, { data: req }); await this.insigniaHistoryRepo.save(history, { data: req });

View file

@ -69,7 +69,10 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
} }
@Get("admin/history/{InsigniaId}") @Get("admin/history/{InsigniaId}")
public async getInsigniaAdminHistory(@Path() InsigniaId: string, @Request() req: RequestWithUser) { public async getInsigniaAdminHistory(
@Path() InsigniaId: string,
@Request() req: RequestWithUser,
) {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const record = await this.insigniaHistoryRepo.find({ const record = await this.insigniaHistoryRepo.find({
relations: { relations: {

View file

@ -162,7 +162,7 @@ export class ProfileLeaveController extends Controller {
} }
@Get("history/{leaveId}") @Get("history/{leaveId}")
public async leaveHistory(@Path() leaveId: string,) { public async leaveHistory(@Path() leaveId: string) {
const record = await this.leaveHistoryRepo.find({ const record = await this.leaveHistoryRepo.find({
relations: { leaveType: true }, relations: { leaveType: true },
where: { profileLeaveId: leaveId }, where: { profileLeaveId: leaveId },

View file

@ -134,7 +134,7 @@ export class ProfileLeaveEmployeeController extends Controller {
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
await this.leaveRepo.save(data, { data: req }); await this.leaveRepo.save(data, { data: req });
setLogDataDiff( req, { before, after: data } ) setLogDataDiff(req, { before, after: data });
history.profileLeaveId = data.id; history.profileLeaveId = data.id;
await this.leaveHistoryRepo.save(history, { data: req }); await this.leaveHistoryRepo.save(history, { data: req });

View file

@ -170,7 +170,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
await Promise.all([ await Promise.all([
this.leaveRepo.save(record), this.leaveRepo.save(record),
setLogDataDiff(req, { before, after: record }), setLogDataDiff(req, { before, after: record }),
this.leaveHistoryRepo.save(history) this.leaveHistoryRepo.save(history),
]); ]);
return new HttpSuccess(); return new HttpSuccess();

View file

@ -93,7 +93,7 @@ export class ProfileNopaidController extends Controller {
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
await this.nopaidRepository.save(data, { data: req }); await this.nopaidRepository.save(data, { data: req });
setLogDataDiff( req, { before, after: data } ) setLogDataDiff(req, { before, after: data });
history.profileNopaidId = data.id; history.profileNopaidId = data.id;
await this.nopaidHistoryRepository.save(history, { data: req }); await this.nopaidHistoryRepository.save(history, { data: req });

View file

@ -98,7 +98,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
await this.nopaidRepository.save(data, { data: req }); await this.nopaidRepository.save(data, { data: req });
setLogDataDiff( req, { before, after: data}) setLogDataDiff(req, { before, after: data });
history.profileNopaidId = data.id; history.profileNopaidId = data.id;
await this.nopaidHistoryRepository.save(history, { data: req }); await this.nopaidHistoryRepository.save(history, { data: req });

View file

@ -55,7 +55,6 @@ export class ProfileOtherController extends Controller {
@Get("admin/history/{otherId}") @Get("admin/history/{otherId}")
public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) { public async otherAdminHistory(@Path() otherId: string, @Request() req: RequestWithUser) {
const _record = await this.otherRepository.findOneBy({ id: otherId }); const _record = await this.otherRepository.findOneBy({ id: otherId });
if (_record) { if (_record) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId); await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
@ -68,7 +67,7 @@ export class ProfileOtherController extends Controller {
} }
@Get("history/{otherId}") @Get("history/{otherId}")
public async otherHistory(@Path() otherId: string,) { public async otherHistory(@Path() otherId: string) {
const record = await this.otherHistoryRepository.find({ const record = await this.otherHistoryRepository.find({
where: { profileOtherId: otherId }, where: { profileOtherId: otherId },
order: { createdAt: "DESC" }, order: { createdAt: "DESC" },

View file

@ -165,7 +165,7 @@ export class ProfileSalaryEmployeeTempController extends Controller {
await Promise.all([ await Promise.all([
this.salaryRepo.save(record, { data: req }), this.salaryRepo.save(record, { data: req }),
setLogDataDiff(req, { before, after: record }), setLogDataDiff(req, { before, after: record }),
this.salaryHistoryRepo.save(history, { data: req }) this.salaryHistoryRepo.save(history, { data: req }),
]); ]);
return new HttpSuccess(); return new HttpSuccess();

View file

@ -72,7 +72,7 @@ export class ProfileTrainingController extends Controller {
} }
@Get("history/{trainingId}") @Get("history/{trainingId}")
public async trainingHistory(@Path() trainingId: string,) { public async trainingHistory(@Path() trainingId: string) {
const record = await this.trainingHistoryRepo.find({ const record = await this.trainingHistoryRepo.find({
where: { where: {
profileTrainingId: trainingId, profileTrainingId: trainingId,
@ -110,7 +110,7 @@ export class ProfileTrainingController extends Controller {
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
await this.trainingRepo.save(data, { data: req }); await this.trainingRepo.save(data, { data: req });
setLogDataDiff( req, { before, after: data} ) setLogDataDiff(req, { before, after: data });
history.profileTrainingId = data.id; history.profileTrainingId = data.id;
await this.trainingHistoryRepo.save(history, { data: req }); await this.trainingHistoryRepo.save(history, { data: req });

View file

@ -119,7 +119,7 @@ export class ProfileTrainingEmployeeController extends Controller {
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
await this.trainingRepo.save(data, { data: req }); await this.trainingRepo.save(data, { data: req });
setLogDataDiff( req, { before, after: data} ) setLogDataDiff(req, { before, after: data });
history.profileTrainingId = data.id; history.profileTrainingId = data.id;
await this.trainingHistoryRepo.save(history, { data: req }); await this.trainingHistoryRepo.save(history, { data: req });

View file

@ -101,7 +101,7 @@ export class ProvinceController extends Controller {
_province.createdAt = new Date(); _province.createdAt = new Date();
_province.lastUpdatedAt = new Date(); _province.lastUpdatedAt = new Date();
await this.provinceRepository.save(_province, { data: request }); await this.provinceRepository.save(_province, { data: request });
setLogDataDiff( request, { before, after: _province} ) setLogDataDiff(request, { before, after: _province });
return new HttpSuccess(); return new HttpSuccess();
} }
@ -135,7 +135,7 @@ export class ProvinceController extends Controller {
_province.lastUpdatedAt = new Date(); _province.lastUpdatedAt = new Date();
this.provinceRepository.merge(_province, requestBody); this.provinceRepository.merge(_province, requestBody);
await this.provinceRepository.save(_province, { data: request }); await this.provinceRepository.save(_province, { data: request });
setLogDataDiff( request, { before, after: _province} ) setLogDataDiff(request, { before, after: _province });
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -61,7 +61,7 @@ export class RankController extends Controller {
rank.createdAt = new Date(); rank.createdAt = new Date();
rank.lastUpdatedAt = new Date(); rank.lastUpdatedAt = new Date();
await this.rankRepository.save(rank, { data: request }); await this.rankRepository.save(rank, { data: request });
setLogDataDiff( request, { before, after: rank} ) setLogDataDiff(request, { before, after: rank });
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -98,7 +98,7 @@ export class RelationshipController extends Controller {
relationship.lastUpdatedAt = new Date(); relationship.lastUpdatedAt = new Date();
this.relationshipRepository.merge(relationship, requestBody); this.relationshipRepository.merge(relationship, requestBody);
await this.relationshipRepository.save(relationship, { data: request }); await this.relationshipRepository.save(relationship, { data: request });
setLogDataDiff( request, { before, after: relationship } ) setLogDataDiff(request, { before, after: relationship });
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -28,11 +28,21 @@ export class ProfileChangePosition extends EntityBase {
@Column({ nullable: true, comment: "ข้อมูลหน่วยงานเดิม เลขที่", default: null }) @Column({ nullable: true, comment: "ข้อมูลหน่วยงานเดิม เลขที่", default: null })
positionNumberOld: string; positionNumberOld: string;
@Column({ nullable: true, comment: "ข้อมูลหน่วยงานเดิม เงินเดือน", type: "double", default: null }) @Column({
nullable: true,
comment: "ข้อมูลหน่วยงานเดิม เงินเดือน",
type: "double",
default: null,
})
amountOld: number; amountOld: number;
@Column({ nullable: true, type: "datetime", comment: "ดำรงตำแหน่งในระดับปัจจุบันเมื่อ", default: null }) @Column({
dateCurrent: Date nullable: true,
type: "datetime",
comment: "ดำรงตำแหน่งในระดับปัจจุบันเมื่อ",
default: null,
})
dateCurrent: Date;
@Column({ nullable: true, comment: "profile Id", default: null }) @Column({ nullable: true, comment: "profile Id", default: null })
profileId: string; profileId: string;
@ -133,8 +143,6 @@ export class ProfileChangePosition extends EntityBase {
@Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง", default: null }) @Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง", default: null })
posLevelName: string; posLevelName: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน root old", default: null }) @Column({ nullable: true, comment: "ชื่อหน่วยงาน root old", default: null })
rootOld: string; rootOld: string;
@ -198,7 +206,12 @@ export class ProfileChangePosition extends EntityBase {
@Column({ nullable: true, comment: "สถานะ", type: "text", default: null }) @Column({ nullable: true, comment: "สถานะ", type: "text", default: null })
status: string; status: string;
@Column({nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง ChangePosition", default: null }) @Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ChangePosition",
default: null,
})
changePositionId: string; changePositionId: string;
@ManyToOne(() => ChangePosition, (v) => v.profileChangePosition) @ManyToOne(() => ChangePosition, (v) => v.profileChangePosition)
@ -209,7 +222,7 @@ export class ProfileChangePosition extends EntityBase {
//เพิ่มรายชื่อผู้ที่ย้ายสับเปลี่ยนตำแหน่ง //เพิ่มรายชื่อผู้ที่ย้ายสับเปลี่ยนตำแหน่ง
export class CreateProfileChangePosition { export class CreateProfileChangePosition {
changePositionId: string; changePositionId: string;
profiles: ProfileItem[] profiles: ProfileItem[];
} }
export class ProfileItem { export class ProfileItem {

View file

@ -1,7 +1,7 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm"; import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { ProfileEmployee } from "./ProfileEmployee" import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileEmployeeEmploymentHistory } from "./ProfileEmployeeEmploymentHistory" import { ProfileEmployeeEmploymentHistory } from "./ProfileEmployeeEmploymentHistory";
@Entity("profileEmployeeEmployment") @Entity("profileEmployeeEmployment")
export class ProfileEmployeeEmployment extends EntityBase { export class ProfileEmployeeEmployment extends EntityBase {
@ -34,7 +34,6 @@ export class ProfileEmployeeEmployment extends EntityBase {
@OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment) @OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment)
histories: ProfileEmployeeEmploymentHistory[]; histories: ProfileEmployeeEmploymentHistory[];
} }
export class CreateEmploymentProfileEmployee { export class CreateEmploymentProfileEmployee {

View file

@ -1,6 +1,6 @@
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 { ProfileEmployeeEmployment } from "./ProfileEmployeeEmployment" import { ProfileEmployeeEmployment } from "./ProfileEmployeeEmployment";
@Entity("profileEmployeeEmploymentHistory") @Entity("profileEmployeeEmploymentHistory")
export class ProfileEmployeeEmploymentHistory extends EntityBase { export class ProfileEmployeeEmploymentHistory extends EntityBase {
@ -30,5 +30,4 @@ export class ProfileEmployeeEmploymentHistory extends EntityBase {
@ManyToOne(() => ProfileEmployeeEmployment, (v) => v.histories) @ManyToOne(() => ProfileEmployeeEmployment, (v) => v.histories)
@JoinColumn({ name: "profileEmployeeEmploymentId" }) @JoinColumn({ name: "profileEmployeeEmploymentId" })
profileEmployeeEmployment: ProfileEmployeeEmployment; profileEmployeeEmployment: ProfileEmployeeEmployment;
} }

View file

@ -4,7 +4,6 @@ import { ProfileEmployee } from "./ProfileEmployee";
@Entity("profileEmployeeInformationHistory") @Entity("profileEmployeeInformationHistory")
export class ProfileEmployeeInformationHistory extends EntityBase { export class ProfileEmployeeInformationHistory extends EntityBase {
@Column({ @Column({
nullable: true, nullable: true,
comment: "กลุ่มงาน", comment: "กลุ่มงาน",

View file

@ -6,7 +6,6 @@ import { ProfileFamilyCoupleHistory } from "./ProfileFamilyCoupleHistory";
@Entity("profileFamilyCouple") @Entity("profileFamilyCouple")
export class ProfileFamilyCouple extends EntityBase { export class ProfileFamilyCouple extends EntityBase {
@Column({ @Column({
nullable: true, nullable: true,
default: null, default: null,
@ -100,7 +99,6 @@ export class ProfileFamilyCouple extends EntityBase {
@ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyCouple) @ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyCouple)
@JoinColumn({ name: "profileEmployeeId" }) @JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee; profileEmployee: ProfileEmployee;
} }
export type CreateProfileFamilyCouple = { export type CreateProfileFamilyCouple = {
@ -114,7 +112,7 @@ export type CreateProfileFamilyCouple = {
coupleCitizenId: string | null; coupleCitizenId: string | null;
coupleLive: boolean | null; coupleLive: boolean | null;
relationship: string | null; relationship: string | null;
} };
export type CreateProfileEmployeeFamilyCouple = { export type CreateProfileEmployeeFamilyCouple = {
profileEmployeeId: string; profileEmployeeId: string;
@ -127,7 +125,7 @@ export type CreateProfileEmployeeFamilyCouple = {
coupleCitizenId: string | null; coupleCitizenId: string | null;
coupleLive: boolean | null; coupleLive: boolean | null;
relationship: string | null; relationship: string | null;
} };
export type UpdateProfileFamilyCouple = { export type UpdateProfileFamilyCouple = {
// couple?: boolean | null; // couple?: boolean | null;

View file

@ -6,7 +6,6 @@ import { ProfileFamilyFatherHistory } from "./ProfileFamilyFatherHistory";
@Entity("profileFamilyFather") @Entity("profileFamilyFather")
export class ProfileFamilyFather extends EntityBase { export class ProfileFamilyFather extends EntityBase {
@Column({ @Column({
nullable: true, nullable: true,
default: null, default: null,
@ -76,7 +75,6 @@ export class ProfileFamilyFather extends EntityBase {
@ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyFather) @ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyFather)
@JoinColumn({ name: "profileEmployeeId" }) @JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee; profileEmployee: ProfileEmployee;
} }
export type CreateProfileFamilyFather = { export type CreateProfileFamilyFather = {
@ -87,7 +85,7 @@ export type CreateProfileFamilyFather = {
fatherCareer: string | null; fatherCareer: string | null;
fatherCitizenId: string | null; fatherCitizenId: string | null;
fatherLive: boolean | null; fatherLive: boolean | null;
} };
export type CreateProfileEmployeeFamilyFather = { export type CreateProfileEmployeeFamilyFather = {
profileEmployeeId: string; profileEmployeeId: string;
@ -97,7 +95,7 @@ export type CreateProfileEmployeeFamilyFather = {
fatherCareer: string | null; fatherCareer: string | null;
fatherCitizenId: string | null; fatherCitizenId: string | null;
fatherLive: boolean | null; fatherLive: boolean | null;
} };
export type UpdateProfileFamilyFather = { export type UpdateProfileFamilyFather = {
fatherPrefix?: string | null; fatherPrefix?: string | null;

View file

@ -6,7 +6,6 @@ import { ProfileFamilyMotherHistory } from "./ProfileFamilyMotherHistory";
@Entity("profileFamilyMother") @Entity("profileFamilyMother")
export class ProfileFamilyMother extends EntityBase { export class ProfileFamilyMother extends EntityBase {
@Column({ @Column({
nullable: true, nullable: true,
default: null, default: null,
@ -76,7 +75,6 @@ export class ProfileFamilyMother extends EntityBase {
@ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyMother) @ManyToOne(() => ProfileEmployee, (v) => v.profileFamilyMother)
@JoinColumn({ name: "profileEmployeeId" }) @JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee; profileEmployee: ProfileEmployee;
} }
export type CreateProfileFamilyMother = { export type CreateProfileFamilyMother = {
@ -87,7 +85,7 @@ export type CreateProfileFamilyMother = {
motherCareer: string | null; motherCareer: string | null;
motherCitizenId: string | null; motherCitizenId: string | null;
motherLive: boolean | null; motherLive: boolean | null;
} };
export type CreateProfileEmployeeFamilyMother = { export type CreateProfileEmployeeFamilyMother = {
profileEmployeeId: string; profileEmployeeId: string;
@ -97,7 +95,7 @@ export type CreateProfileEmployeeFamilyMother= {
motherCareer: string | null; motherCareer: string | null;
motherCitizenId: string | null; motherCitizenId: string | null;
motherLive: boolean | null; motherLive: boolean | null;
} };
export type UpdateProfileFamilyMother = { export type UpdateProfileFamilyMother = {
motherPrefix: string | null; motherPrefix: string | null;

View file

@ -1,10 +1,4 @@
import { import { Entity, Column, JoinColumn, ManyToOne, Double } from "typeorm";
Entity,
Column,
JoinColumn,
ManyToOne,
Double,
} from "typeorm";
import { EntityBase } from "./base/Base"; import { EntityBase } from "./base/Base";
import { ProfileSalary } from "./ProfileSalary"; import { ProfileSalary } from "./ProfileSalary";

View file

@ -251,11 +251,7 @@ export async function updateName(
* *
* @returns user uuid or true if success, false otherwise. * @returns user uuid or true if success, false otherwise.
*/ */
export async function enableStatus( export async function enableStatus(userId: string, status: boolean) {
userId: string,
status: boolean,
) {
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/users/${userId}`, { const res = await fetch(`${KC_URL}/admin/realms/${KC_REALM}/users/${userId}`, {
headers: { headers: {
authorization: `Bearer ${await getToken()}`, authorization: `Bearer ${await getToken()}`,
@ -661,6 +657,4 @@ export async function removeUserGroup(userId: string, groupId: string) {
} }
return true; return true;
} }

View file

@ -7,11 +7,7 @@ import HttpStatus from "../interfaces/http-status";
if (!process.env.AUTH_PUBLIC_KEY && !process.env.AUTH_REALM_URL) { if (!process.env.AUTH_PUBLIC_KEY && !process.env.AUTH_REALM_URL) {
throw new Error("Require keycloak AUTH_PUBLIC_KEY or AUTH_REALM_URL."); throw new Error("Require keycloak AUTH_PUBLIC_KEY or AUTH_REALM_URL.");
} }
if ( if (process.env.AUTH_PUBLIC_KEY && process.env.AUTH_REALM_URL && !process.env.AUTH_PREFERRED_MODE) {
process.env.AUTH_PUBLIC_KEY &&
process.env.AUTH_REALM_URL &&
!process.env.AUTH_PREFERRED_MODE
) {
throw new Error( throw new Error(
"AUTH_PREFFERRED must be specified if AUTH_PUBLIC_KEY and AUTH_REALM_URL is provided.", "AUTH_PREFFERRED must be specified if AUTH_PUBLIC_KEY and AUTH_REALM_URL is provided.",
); );

View file

@ -13,6 +13,6 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true "skipLibCheck": true,
} },
} }

View file

@ -27,73 +27,96 @@
}, },
"tags": [ "tags": [
{ {
"name": "Organization", "description": "โครงสร้างส่วนอื่น ๆ" "name": "Organization",
"description": "โครงสร้างส่วนอื่น ๆ"
}, },
{ {
"name": "OrgRoot", "description": "โครงสร้างระดับ root" "name": "OrgRoot",
"description": "โครงสร้างระดับ root"
}, },
{ {
"name": "OrgChild1", "description": "โครงสร้างระดับ 1" "name": "OrgChild1",
"description": "โครงสร้างระดับ 1"
}, },
{ {
"name": "OrgChild2", "description": "โครงสร้างระดับ 2" "name": "OrgChild2",
"description": "โครงสร้างระดับ 2"
}, },
{ {
"name": "OrgChild3", "description": "โครงสร้างระดับ 3" "name": "OrgChild3",
"description": "โครงสร้างระดับ 3"
}, },
{ {
"name": "OrgChild4", "description": "โครงสร้างระดับ 4" "name": "OrgChild4",
"description": "โครงสร้างระดับ 4"
}, },
{ {
"name": "Position", "description": "ตำแหน่ง" "name": "Position",
"description": "ตำแหน่ง"
}, },
{ {
"name": "PosType", "description": "ประเภทตำแหน่ง" "name": "PosType",
"description": "ประเภทตำแหน่ง"
}, },
{ {
"name": "PosLevel", "description": "ระดับตำแหน่ง" "name": "PosLevel",
"description": "ระดับตำแหน่ง"
}, },
{ {
"name": "PosExecutive", "description": "ตำแหน่งทางการบริหาร" "name": "PosExecutive",
"description": "ตำแหน่งทางการบริหาร"
}, },
{ {
"name": "Prefix", "description": "คำนำหน้า" "name": "Prefix",
"description": "คำนำหน้า"
}, },
{ {
"name": "Rank", "description": "ยศ" "name": "Rank",
"description": "ยศ"
}, },
{ {
"name": "BloodGroup", "description": "กลุ่มเลือด" "name": "BloodGroup",
"description": "กลุ่มเลือด"
}, },
{ {
"name": "Gender", "description": "เพศ" "name": "Gender",
"description": "เพศ"
}, },
{ {
"name": "Religion", "description": "ศาสนา" "name": "Religion",
"description": "ศาสนา"
}, },
{ {
"name": "Relationship", "description": "สถานภาพ" "name": "Relationship",
"description": "สถานภาพ"
}, },
{ {
"name": "EducationLevel", "description": "ระดับการศึกษา" "name": "EducationLevel",
"description": "ระดับการศึกษา"
}, },
{ {
"name": "OrganizationUnauthorize", "description": "โครงสร้างส่วนอื่น ๆ (Unauthorize)" "name": "OrganizationUnauthorize",
"description": "โครงสร้างส่วนอื่น ๆ (Unauthorize)"
}, },
{ {
"name": "Employee", "description": "ตำแหน่งลูกจ้างประจำ" "name": "Employee",
"description": "ตำแหน่งลูกจ้างประจำ"
}, },
{ {
"name": "EmployeePosType", "description": "กลุ่มงานลูกจ้างประจำ" "name": "EmployeePosType",
"description": "กลุ่มงานลูกจ้างประจำ"
}, },
{ {
"name": "EmployeePosLevel", "description": "ระดับชั้นงานลูกจ้างประจำ" "name": "EmployeePosLevel",
"description": "ระดับชั้นงานลูกจ้างประจำ"
}, },
{ {
"name": "InsigniaType", "description": "ลำดับชั้นเครื่องราชอิสริยาภรณ์" "name": "InsigniaType",
"description": "ลำดับชั้นเครื่องราชอิสริยาภรณ์"
}, },
{ {
"name": "Insignia", "description": "เครื่องราชอิสริยาภรณ์" "name": "Insignia",
"description": "เครื่องราชอิสริยาภรณ์"
} }
] ]
}, },