add dpis controller
This commit is contained in:
parent
497decefe4
commit
4852131651
74 changed files with 606 additions and 336 deletions
33
.env.example
33
.env.example
|
|
@ -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
|
||||||
|
|
@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- แก้ชนิด type ที่ reques
|
- แก้ชนิด type ที่ reques
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ export class BloodGroupController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรุ๊ปเลือดนี้");
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.bloodGroupRepository.remove(delBloodGroup,{ data: request });
|
await this.bloodGroupRepository.remove(delBloodGroup, { data: request });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
253
src/controllers/DPISController.ts
Normal file
253
src/controllers/DPISController.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -265,7 +265,7 @@ export class DevelopmentRequestController extends Controller {
|
||||||
record.lastUpdateFullName = req.user.name;
|
record.lastUpdateFullName = req.user.name;
|
||||||
record.lastUpdatedAt = new Date();
|
record.lastUpdatedAt = new Date();
|
||||||
|
|
||||||
await this.developmentRequestRepository.save(record, {data: req});
|
await this.developmentRequestRepository.save(record, { data: req });
|
||||||
setLogDataDiff(req, { before, after: record });
|
setLogDataDiff(req, { before, after: record });
|
||||||
await this.developmentProjectRepository.delete({ developmentRequestId: record.id });
|
await this.developmentProjectRepository.delete({ developmentRequestId: record.id });
|
||||||
if (body.developmentProjects != null) {
|
if (body.developmentProjects != null) {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export class DistrictController extends Controller {
|
||||||
_district.lastUpdateUserId = request.user.sub;
|
_district.lastUpdateUserId = request.user.sub;
|
||||||
_district.lastUpdateFullName = request.user.name;
|
_district.lastUpdateFullName = request.user.name;
|
||||||
_district.lastUpdatedAt = new Date();
|
_district.lastUpdatedAt = new Date();
|
||||||
await this.districtRepository.save(_district, { data: request});
|
await this.districtRepository.save(_district, { data: request });
|
||||||
setLogDataDiff(request, { before, after: _district });
|
setLogDataDiff(request, { before, after: _district });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export class EducationLevelController extends Controller {
|
||||||
educationLevel.lastUpdateFullName = request.user.name;
|
educationLevel.lastUpdateFullName = request.user.name;
|
||||||
educationLevel.lastUpdatedAt = new Date();
|
educationLevel.lastUpdatedAt = new Date();
|
||||||
await this.educationLevelRepository.save(educationLevel, { data: request });
|
await this.educationLevelRepository.save(educationLevel, { data: request });
|
||||||
setLogDataDiff( request, { before, after: educationLevel } );
|
setLogDataDiff(request, { before, after: educationLevel });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ export class EducationLevelController extends Controller {
|
||||||
educationLevel.lastUpdatedAt = new Date();
|
educationLevel.lastUpdatedAt = new Date();
|
||||||
this.educationLevelRepository.merge(educationLevel, requestBody);
|
this.educationLevelRepository.merge(educationLevel, requestBody);
|
||||||
await this.educationLevelRepository.save(educationLevel, { data: request });
|
await this.educationLevelRepository.save(educationLevel, { data: request });
|
||||||
setLogDataDiff( request, { before, after: educationLevel } );
|
setLogDataDiff(request, { before, after: educationLevel });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,14 +108,14 @@ export class EducationLevelController extends Controller {
|
||||||
* @param {string} id Id ระดับการศึกษา
|
* @param {string} id Id ระดับการศึกษา
|
||||||
*/
|
*/
|
||||||
@Delete("{id}")
|
@Delete("{id}")
|
||||||
async deleteEducationLevel(@Path() id: string , @Request() request: RequestWithUser) {
|
async deleteEducationLevel(@Path() id: string, @Request() request: RequestWithUser) {
|
||||||
const delEducationLevel = await this.educationLevelRepository.findOne({
|
const delEducationLevel = await this.educationLevelRepository.findOne({
|
||||||
where: { id },
|
where: { id },
|
||||||
});
|
});
|
||||||
if (!delEducationLevel) {
|
if (!delEducationLevel) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับการศึกษานี้");
|
||||||
}
|
}
|
||||||
await this.educationLevelRepository.remove(delEducationLevel,{ data: request });
|
await this.educationLevelRepository.remove(delEducationLevel, { data: request });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -609,7 +609,7 @@ export class EmployeePositionController extends Controller {
|
||||||
position.lastUpdateUserId = request.user.sub;
|
position.lastUpdateUserId = request.user.sub;
|
||||||
position.lastUpdateFullName = request.user.name;
|
position.lastUpdateFullName = request.user.name;
|
||||||
position.lastUpdatedAt = new Date();
|
position.lastUpdatedAt = new Date();
|
||||||
await this.employeePositionRepository.save(position, { data: request});
|
await this.employeePositionRepository.save(position, { data: request });
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
return new HttpSuccess(posMaster.id);
|
return new HttpSuccess(posMaster.id);
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export class GenderController extends Controller {
|
||||||
_gender.createdAt = new Date();
|
_gender.createdAt = new Date();
|
||||||
_gender.lastUpdatedAt = new Date();
|
_gender.lastUpdatedAt = new Date();
|
||||||
await this.genderRepository.save(_gender, { data: request });
|
await this.genderRepository.save(_gender, { data: request });
|
||||||
setLogDataDiff( request, { before, after: _gender } );
|
setLogDataDiff(request, { before, after: _gender });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ export class GenderController extends Controller {
|
||||||
_gender.lastUpdatedAt = new Date();
|
_gender.lastUpdatedAt = new Date();
|
||||||
this.genderRepository.merge(_gender, requestBody);
|
this.genderRepository.merge(_gender, requestBody);
|
||||||
await this.genderRepository.save(_gender, { data: request });
|
await this.genderRepository.save(_gender, { data: request });
|
||||||
setLogDataDiff( request, { before, after: _gender } );
|
setLogDataDiff(request, { before, after: _gender });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ export class GenderController extends Controller {
|
||||||
if (!_delGender) {
|
if (!_delGender) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเพศนี้");
|
||||||
}
|
}
|
||||||
await this.genderRepository.remove(_delGender, {data: request});
|
await this.genderRepository.remove(_delGender, { data: request });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,20 +229,16 @@ export class InsigniaController extends Controller {
|
||||||
async GetInsigniaPath(@Path() path: string, @Request() request: RequestWithUser) {
|
async GetInsigniaPath(@Path() path: string, @Request() request: RequestWithUser) {
|
||||||
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({
|
||||||
|
|
|
||||||
|
|
@ -202,22 +202,19 @@ export class InsigniaTypeController extends Controller {
|
||||||
async GetInsigniaTypePath(@Path() path: string, @Request() request: RequestWithUser) {
|
async GetInsigniaTypePath(@Path() path: string, @Request() request: RequestWithUser) {
|
||||||
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({
|
||||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||||
where: {isActive : true},
|
where: { isActive: true },
|
||||||
order: { name: "ASC" },
|
order: { name: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(insigniaTypeAll);
|
return new HttpSuccess(insigniaTypeAll);
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ export class OrgChild1Controller {
|
||||||
child1.orgChild1Order =
|
child1.orgChild1Order =
|
||||||
order == null || order.orgChild1Order == null ? 1 : order.orgChild1Order + 1;
|
order == null || order.orgChild1Order == null ? 1 : order.orgChild1Order + 1;
|
||||||
await this.child1Repository.save(child1, { data: request });
|
await this.child1Repository.save(child1, { data: request });
|
||||||
setLogDataDiff( request, { before , after: child1});
|
setLogDataDiff(request, { before, after: child1 });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,7 +308,7 @@ export class OrgChild1Controller {
|
||||||
child1.responsibility = child1.responsibility || "";
|
child1.responsibility = child1.responsibility || "";
|
||||||
this.child1Repository.merge(child1, requestBody);
|
this.child1Repository.merge(child1, requestBody);
|
||||||
await this.child1Repository.save(child1, { data: request });
|
await this.child1Repository.save(child1, { data: request });
|
||||||
setLogDataDiff( request, { before, after: child1 });
|
setLogDataDiff(request, { before, after: child1 });
|
||||||
|
|
||||||
const up_Child2 = await this.child2Repository.find({
|
const up_Child2 = await this.child2Repository.find({
|
||||||
where: {
|
where: {
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ export class OrgChild2Controller extends Controller {
|
||||||
child2.orgChild2Order =
|
child2.orgChild2Order =
|
||||||
order == null || order.orgChild2Order == null ? 1 : order.orgChild2Order + 1;
|
order == null || order.orgChild2Order == null ? 1 : order.orgChild2Order + 1;
|
||||||
await this.child2Repository.save(child2, { data: request });
|
await this.child2Repository.save(child2, { data: request });
|
||||||
setLogDataDiff( request, { before, after: child2 } );
|
setLogDataDiff(request, { before, after: child2 });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,7 +238,7 @@ export class OrgChild2Controller extends Controller {
|
||||||
child2.orgChild1Id = String(child1IdExits?.id);
|
child2.orgChild1Id = String(child1IdExits?.id);
|
||||||
this.child2Repository.merge(child2, requestBody);
|
this.child2Repository.merge(child2, requestBody);
|
||||||
await this.child2Repository.save(child2, { data: request });
|
await this.child2Repository.save(child2, { data: request });
|
||||||
setLogDataDiff( request, { before, after: child2 } );
|
setLogDataDiff(request, { before, after: child2 });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ export class OrgChild3Controller {
|
||||||
where: [{ posMasterId: In(empPosMasters.map((x) => x.id)) }],
|
where: [{ posMasterId: In(empPosMasters.map((x) => x.id)) }],
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.empPositionRepository.remove(empPositions, { data: request});
|
await this.empPositionRepository.remove(empPositions, { data: request });
|
||||||
await this.empPosMasterRepository.remove(empPosMasters, { data: request });
|
await this.empPosMasterRepository.remove(empPosMasters, { data: request });
|
||||||
await this.positionRepository.remove(positions, { data: request });
|
await this.positionRepository.remove(positions, { data: request });
|
||||||
await this.posMasterRepository.remove(posMasters, { data: request });
|
await this.posMasterRepository.remove(posMasters, { data: request });
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ export class OrgRootController extends Controller {
|
||||||
orgRoot.lastUpdatedAt = new Date();
|
orgRoot.lastUpdatedAt = new Date();
|
||||||
this.orgRootRepository.merge(orgRoot, requestBody);
|
this.orgRootRepository.merge(orgRoot, requestBody);
|
||||||
await this.orgRootRepository.save(orgRoot, { data: request });
|
await this.orgRootRepository.save(orgRoot, { data: request });
|
||||||
setLogDataDiff(request, {before, after: orgRoot});
|
setLogDataDiff(request, { before, after: orgRoot });
|
||||||
|
|
||||||
if (orgRoot.orgRootRankSub == "DISTRICT" || orgRoot.orgRootRankSub == "OFFICE") {
|
if (orgRoot.orgRootRankSub == "DISTRICT" || orgRoot.orgRootRankSub == "OFFICE") {
|
||||||
const up_Child1 = await this.child1Repository.find({
|
const up_Child1 = await this.child1Repository.find({
|
||||||
|
|
@ -374,7 +374,7 @@ export class OrgRootController extends Controller {
|
||||||
const empPositions = await this.empPositionRepository.find({
|
const empPositions = await this.empPositionRepository.find({
|
||||||
where: [{ posMasterId: In(empPosMasters.map((x) => x.id)) }],
|
where: [{ posMasterId: In(empPosMasters.map((x) => x.id)) }],
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.empPositionRepository.remove(empPositions, { data: request });
|
await this.empPositionRepository.remove(empPositions, { data: request });
|
||||||
await this.empPosMasterRepository.remove(empPosMasters, { data: request });
|
await this.empPosMasterRepository.remove(empPosMasters, { data: request });
|
||||||
await this.positionRepository.remove(positions, { data: request });
|
await this.positionRepository.remove(positions, { data: request });
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,9 @@ export class OrganizationDotnetController extends Controller {
|
||||||
profileEmp.map((item: ProfileEmployee) => {
|
profileEmp.map((item: ProfileEmployee) => {
|
||||||
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)
|
||||||
|
|
@ -169,7 +170,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
?.orgRoot != null
|
?.orgRoot != null
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: null;
|
: null;
|
||||||
return {
|
return {
|
||||||
oc: rootName,
|
oc: rootName,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
createdAt: item.createdAt,
|
createdAt: item.createdAt,
|
||||||
|
|
@ -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_);
|
||||||
}
|
}
|
||||||
|
|
@ -902,15 +903,15 @@ export class OrganizationDotnetController extends Controller {
|
||||||
const profile = await this.profileRepo.find({
|
const profile = await this.profileRepo.find({
|
||||||
where: { keycloak: Not(IsNull()) || Not("") },
|
where: { keycloak: Not(IsNull()) || Not("") },
|
||||||
relations: [
|
relations: [
|
||||||
"posType",
|
"posType",
|
||||||
"posLevel",
|
"posLevel",
|
||||||
"current_holders",
|
"current_holders",
|
||||||
"current_holders.orgRoot",
|
"current_holders.orgRoot",
|
||||||
"current_holders.orgChild1",
|
"current_holders.orgChild1",
|
||||||
"current_holders.orgChild2",
|
"current_holders.orgChild2",
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
"profileSalary"
|
"profileSalary",
|
||||||
],
|
],
|
||||||
order: {
|
order: {
|
||||||
profileSalary: {
|
profileSalary: {
|
||||||
|
|
@ -922,13 +923,14 @@ export class OrganizationDotnetController extends Controller {
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const profile_ = await Promise.all(
|
const profile_ = await Promise.all(
|
||||||
profile.map((item: Profile) => {
|
profile.map((item: Profile) => {
|
||||||
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)
|
||||||
|
|
@ -955,7 +957,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.orgRoot.orgRootShortName}${item.current_holders.find((x) => x.orgRevisionId == findRevision?.id)?.posMasterNo}`
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
oc: rootName,
|
oc: rootName,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
createdAt: item.createdAt,
|
createdAt: item.createdAt,
|
||||||
|
|
@ -1008,14 +1010,12 @@ 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_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -990,7 +990,7 @@ export class PositionController extends Controller {
|
||||||
posMaster.createdAt = new Date();
|
posMaster.createdAt = new Date();
|
||||||
posMaster.lastUpdatedAt = new Date();
|
posMaster.lastUpdatedAt = new Date();
|
||||||
await this.posMasterRepository.save(posMaster, { data: request });
|
await this.posMasterRepository.save(posMaster, { data: request });
|
||||||
setLogDataDiff( request, { before, after: posMaster });
|
setLogDataDiff(request, { before, after: posMaster });
|
||||||
await this.positionRepository.delete({ posMasterId: posMaster.id });
|
await this.positionRepository.delete({ posMasterId: posMaster.id });
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
|
@ -3000,7 +3000,7 @@ export class PositionController extends Controller {
|
||||||
dataMaster.isSit = requestBody.isSit;
|
dataMaster.isSit = requestBody.isSit;
|
||||||
dataMaster.next_holderId = requestBody.profileId;
|
dataMaster.next_holderId = requestBody.profileId;
|
||||||
await this.posMasterRepository.save(dataMaster, { data: request });
|
await this.posMasterRepository.save(dataMaster, { data: request });
|
||||||
setLogDataDiff( request, { before, after: dataMaster });
|
setLogDataDiff(request, { before, after: dataMaster });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ export class PrefixController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
|
||||||
}
|
}
|
||||||
|
|
||||||
const before = null;
|
const before = null;
|
||||||
_prefix.createdUserId = request.user.sub;
|
_prefix.createdUserId = request.user.sub;
|
||||||
_prefix.createdFullName = request.user.name;
|
_prefix.createdFullName = request.user.name;
|
||||||
_prefix.lastUpdateUserId = request.user.sub;
|
_prefix.lastUpdateUserId = request.user.sub;
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ export class PrefixController extends Controller {
|
||||||
if (!_delPrefix) {
|
if (!_delPrefix) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำนำหน้าชื่อนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำนำหน้าชื่อนี้");
|
||||||
}
|
}
|
||||||
await this.prefixRepository.remove(_delPrefix,{ data: request });
|
await this.prefixRepository.remove(_delPrefix, { data: request });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export class ProfileAssessmentsController extends Controller {
|
||||||
if (_record) {
|
if (_record) {
|
||||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await this.profileAssessmentsHistoryRepository.find({
|
const record = await this.profileAssessmentsHistoryRepository.find({
|
||||||
where: {
|
where: {
|
||||||
profileAssessmentId: assessmentId,
|
profileAssessmentId: assessmentId,
|
||||||
|
|
@ -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,
|
||||||
|
|
@ -139,10 +137,10 @@ export class ProfileAssessmentsController extends Controller {
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
||||||
await this.profileAssessmentsRepository.save(data, { data: req });
|
await this.profileAssessmentsRepository.save(data, { data: req });
|
||||||
setLogDataDiff( req, { before, after: data } );
|
setLogDataDiff(req, { before, after: data });
|
||||||
history.profileAssessmentId = data.id;
|
history.profileAssessmentId = data.id;
|
||||||
await this.profileAssessmentsHistoryRepository.save(history, { data: req });
|
await this.profileAssessmentsHistoryRepository.save(history, { data: req });
|
||||||
setLogDataDiff( req, { before, after: history } );
|
setLogDataDiff(req, { before, after: history });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
@ -136,10 +138,10 @@ export class ProfileAssessmentsEmployeeController extends Controller {
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
||||||
await this.profileAssessmentsRepository.save(data, { data: req });
|
await this.profileAssessmentsRepository.save(data, { data: req });
|
||||||
setLogDataDiff( req, { before, after: data });
|
setLogDataDiff(req, { before, after: data });
|
||||||
history.profileAssessmentId = data.id;
|
history.profileAssessmentId = data.id;
|
||||||
await this.profileAssessmentsHistoryRepository.save(history, { data: req });
|
await this.profileAssessmentsHistoryRepository.save(history, { data: req });
|
||||||
setLogDataDiff( req, { before, after: history });
|
setLogDataDiff(req, { before, after: history });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,7 @@ export class ProfileAvatarController extends Controller {
|
||||||
if (!_record) {
|
if (!_record) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
await this.avatarRepository.remove(_record, {data: req});
|
await this.avatarRepository.remove(_record, { data: req });
|
||||||
|
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,11 +131,11 @@ export class ProfileAvatarEmployeeController extends Controller {
|
||||||
data.isActive = true;
|
data.isActive = true;
|
||||||
data.avatar = avatar;
|
data.avatar = avatar;
|
||||||
data.avatarName = fileName;
|
data.avatarName = fileName;
|
||||||
await this.avatarRepository.save(data, {data: req});
|
await this.avatarRepository.save(data, { data: req });
|
||||||
setLogDataDiff(req, { before, after: data });
|
setLogDataDiff(req, { before, after: data });
|
||||||
profile.avatar = avatar;
|
profile.avatar = avatar;
|
||||||
profile.avatarName = fileName;
|
profile.avatarName = fileName;
|
||||||
await this.profileRepository.save(profile, {data: req});
|
await this.profileRepository.save(profile, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess({ avatar: avatar, avatarName: fileName });
|
return new HttpSuccess({ avatar: avatar, avatarName: fileName });
|
||||||
}
|
}
|
||||||
|
|
@ -153,8 +153,8 @@ export class ProfileAvatarEmployeeController extends Controller {
|
||||||
if (!_record) {
|
if (!_record) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.avatarRepository.remove(_record, {data: req});
|
await this.avatarRepository.remove(_record, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,11 +132,11 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
||||||
data.isActive = true;
|
data.isActive = true;
|
||||||
data.avatar = avatar;
|
data.avatar = avatar;
|
||||||
data.avatarName = fileName;
|
data.avatarName = fileName;
|
||||||
await this.avatarRepository.save(data, {data: req});
|
await this.avatarRepository.save(data, { data: req });
|
||||||
setLogDataDiff( req, {before, after: data});
|
setLogDataDiff(req, { before, after: data });
|
||||||
profile.avatar = avatar;
|
profile.avatar = avatar;
|
||||||
profile.avatarName = fileName;
|
profile.avatarName = fileName;
|
||||||
await this.profileRepository.save(profile, {data: req});
|
await this.profileRepository.save(profile, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess({ avatar: avatar, avatarName: fileName });
|
return new HttpSuccess({ avatar: avatar, avatarName: fileName });
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +148,7 @@ export class ProfileAvatarEmployeeTempController extends Controller {
|
||||||
if (!_record) {
|
if (!_record) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
await this.avatarRepository.remove(_record, { data: req});
|
await this.avatarRepository.remove(_record, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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: {
|
||||||
|
|
@ -111,10 +114,10 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
||||||
await this.certificateRepo.save(data, { data: req });
|
await this.certificateRepo.save(data, { data: req });
|
||||||
setLogDataDiff( req , {before, after: data});
|
setLogDataDiff(req, { before, after: data });
|
||||||
history.profileCertificateId = data.id;
|
history.profileCertificateId = data.id;
|
||||||
await this.certificateHistoryRepo.save(history, { data: req });
|
await this.certificateHistoryRepo.save(history, { data: req });
|
||||||
setLogDataDiff( req , {before, after: history});
|
setLogDataDiff(req, { before, after: history });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
@ -149,11 +152,11 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.certificateRepo.save(record, { data: req }),
|
this.certificateRepo.save(record, { data: req }),
|
||||||
setLogDataDiff( req , {before, after: record}),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.certificateHistoryRepo.save(history, { data: req }),
|
this.certificateHistoryRepo.save(history, { data: req }),
|
||||||
setLogDataDiff( req , {before: before_null, after: history}),
|
setLogDataDiff(req, { before: before_null, after: history }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,11 @@ 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;
|
||||||
await this.profileRepository.save(profile, { data:req });
|
await this.profileRepository.save(profile, { data: req });
|
||||||
setLogDataDiff(req, { before, after: profile });
|
setLogDataDiff(req, { before, after: profile });
|
||||||
|
|
||||||
if (profile != null && profile.keycloak != null) {
|
if (profile != null && profile.keycloak != null) {
|
||||||
|
|
@ -149,9 +149,9 @@ export class ProfileChangeNameController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.changeNameRepository.save(record, { data: req }),
|
this.changeNameRepository.save(record, { data: req }),
|
||||||
setLogDataDiff( req , {before, after: record}),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.changeNameHistoryRepository.save(history, { data: req }),
|
this.changeNameHistoryRepository.save(history, { data: req }),
|
||||||
setLogDataDiff( req , {before: before_null, after: history}),
|
setLogDataDiff(req, { before: before_null, after: history }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const chkLastRecord = await this.changeNameRepository.findOne({
|
const chkLastRecord = await this.changeNameRepository.findOne({
|
||||||
|
|
@ -163,7 +163,7 @@ export class ProfileChangeNameController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!chkLastRecord) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!chkLastRecord) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const profile = await this.profileRepository.findOneBy({ id: record.profileId });
|
const profile = await this.profileRepository.findOneBy({ id: record.profileId });
|
||||||
const before_profile = structuredClone(profile);
|
const before_profile = structuredClone(profile);
|
||||||
if (profile && chkLastRecord.id === record.id) {
|
if (profile && chkLastRecord.id === record.id) {
|
||||||
|
|
@ -171,7 +171,7 @@ export class ProfileChangeNameController extends Controller {
|
||||||
profile.lastName = body.lastName ?? profile.lastName;
|
profile.lastName = body.lastName ?? profile.lastName;
|
||||||
profile.prefix = body.prefix ?? profile.prefix;
|
profile.prefix = body.prefix ?? profile.prefix;
|
||||||
await this.profileRepository.save(profile, { data: req });
|
await this.profileRepository.save(profile, { data: req });
|
||||||
setLogDataDiff( req , {before: before_profile, after: profile});
|
setLogDataDiff(req, { before: before_profile, after: profile });
|
||||||
}
|
}
|
||||||
|
|
||||||
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
|
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
|
||||||
|
|
|
||||||
|
|
@ -99,16 +99,16 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
||||||
await this.changeNameRepository.save(data, { data: req });
|
await this.changeNameRepository.save(data, { data: req });
|
||||||
setLogDataDiff( req , {before, after: data});
|
setLogDataDiff(req, { before, after: 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;
|
||||||
await this.profileEmployeeRepo.save(profile, {data: req});
|
await this.profileEmployeeRepo.save(profile, { data: req });
|
||||||
setLogDataDiff( req, {before, after: profile});
|
setLogDataDiff(req, { before, after: profile });
|
||||||
|
|
||||||
if (profile != null && profile.keycloak != null) {
|
if (profile != null && profile.keycloak != null) {
|
||||||
const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
|
const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ export class ProfileChildrenEmployeeController extends Controller {
|
||||||
setLogDataDiff(req, { before, after: data });
|
setLogDataDiff(req, { before, after: data });
|
||||||
history.profileChildrenId = data.id;
|
history.profileChildrenId = data.id;
|
||||||
await this.childrenHistoryRepository.save(history, { data: req });
|
await this.childrenHistoryRepository.save(history, { data: req });
|
||||||
setLogDataDiff( req, { before, after: history });
|
setLogDataDiff(req, { before, after: history });
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2537,7 +2537,7 @@ export class ProfileController extends Controller {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
const record = await this.profileRepo.findOneBy({ id });
|
const record = await this.profileRepo.findOneBy({ id });
|
||||||
const before = structuredClone(record);
|
const before = structuredClone(record);
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
|
|
@ -5758,7 +5758,7 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
await this.profileRepo.save(profile, { data: request });
|
await this.profileRepo.save(profile, { data: request });
|
||||||
setLogDataDiff(request, { before, after: profile });
|
setLogDataDiff(request, { before, after: profile });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,10 +128,10 @@ export class ProfileHonorController extends Controller {
|
||||||
const history = new ProfileHonorHistory();
|
const history = new ProfileHonorHistory();
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
||||||
await this.honorRepo.save(data, {data: req});
|
await this.honorRepo.save(data, { data: req });
|
||||||
setLogDataDiff(req, { before, after: data });
|
setLogDataDiff(req, { before, after: data });
|
||||||
history.profileHonorId = data.id;
|
history.profileHonorId = data.id;
|
||||||
await this.honorHistoryRepo.save(history, {data: req});
|
await this.honorHistoryRepo.save(history, { data: req });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export class ProfileInsigniaController extends Controller {
|
||||||
});
|
});
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("admin/history/{InsigniaId}")
|
@Get("admin/history/{InsigniaId}")
|
||||||
public async getInsigniaAdminHistory(
|
public async getInsigniaAdminHistory(
|
||||||
@Path() InsigniaId: string,
|
@Path() InsigniaId: string,
|
||||||
|
|
@ -142,7 +142,7 @@ export class ProfileInsigniaController 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 });
|
||||||
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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 });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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: {
|
||||||
|
|
@ -142,7 +145,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
||||||
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 });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 },
|
||||||
|
|
@ -206,7 +206,7 @@ export class ProfileLeaveController 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 });
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ export class ProfileLeaveController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.leaveRepo.save(record, { data: req }),
|
this.leaveRepo.save(record, { data: req }),
|
||||||
setLogDataDiff( req, { before, after: record }),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.leaveHistoryRepo.save(history, { data: req }),
|
this.leaveHistoryRepo.save(history, { data: req }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 });
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ export class ProfileLeaveEmployeeController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.leaveRepo.save(record, { data: req }),
|
this.leaveRepo.save(record, { data: req }),
|
||||||
setLogDataDiff( req, { before, after: record } ),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.leaveHistoryRepo.save(history, { data: req }),
|
this.leaveHistoryRepo.save(history, { data: req }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,8 @@ 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();
|
||||||
|
|
|
||||||
|
|
@ -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 });
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ export class ProfileNopaidController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.nopaidRepository.save(record, { data: req }),
|
this.nopaidRepository.save(record, { data: req }),
|
||||||
setLogDataDiff( req, { before, after: record } ),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.nopaidHistoryRepository.save(history, { data: req }),
|
this.nopaidHistoryRepository.save(history, { data: req }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,10 +97,10 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
||||||
const history = new ProfileNopaidHistory();
|
const history = new ProfileNopaidHistory();
|
||||||
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 });
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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" },
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export class ProfileOtherEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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({
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
||||||
Object.assign(history, { ...data, id: undefined });
|
Object.assign(history, { ...data, id: undefined });
|
||||||
|
|
||||||
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 });
|
||||||
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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 });
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ export class ProfileTrainingController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.trainingRepo.save(record, { data: req }),
|
this.trainingRepo.save(record, { data: req }),
|
||||||
setLogDataDiff( req, { before, after: record} ),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.trainingHistoryRepo.save(history, { data: req }),
|
this.trainingHistoryRepo.save(history, { data: req }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,8 @@ export class ProfileTrainingEmployeeController extends Controller {
|
||||||
const history = new ProfileTrainingHistory();
|
const history = new ProfileTrainingHistory();
|
||||||
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 });
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ export class ProfileTrainingEmployeeController extends Controller {
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...record, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileTrainingId = trainingId;
|
history.profileTrainingId = trainingId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
record.lastUpdateFullName = req.user.name;
|
record.lastUpdateFullName = req.user.name;
|
||||||
|
|
@ -158,7 +158,7 @@ export class ProfileTrainingEmployeeController extends Controller {
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.trainingRepo.save(record, { data: req }),
|
this.trainingRepo.save(record, { data: req }),
|
||||||
setLogDataDiff( req, { before, after: record} ),
|
setLogDataDiff(req, { before, after: record }),
|
||||||
this.trainingHistoryRepo.save(history, { data: req }),
|
this.trainingHistoryRepo.save(history, { data: req }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ export class RelationshipController extends Controller {
|
||||||
relationship.createdAt = new Date();
|
relationship.createdAt = new Date();
|
||||||
relationship.lastUpdatedAt = new Date();
|
relationship.lastUpdatedAt = new Date();
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import { RequestWithUser } from "../middlewares/user";
|
||||||
import { addLogSequence } from "../interfaces/utils";
|
import { addLogSequence } from "../interfaces/utils";
|
||||||
|
|
||||||
export class MyCustomLogger implements Logger {
|
export class MyCustomLogger implements Logger {
|
||||||
log(level: "log" | "info" | "warn", message: any, queryRunner?: QueryRunner) { }
|
log(level: "log" | "info" | "warn", message: any, queryRunner?: QueryRunner) {}
|
||||||
|
|
||||||
logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner): void {
|
logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner): void {
|
||||||
const req = queryRunner?.data as RequestWithUser;
|
const req = queryRunner?.data as RequestWithUser;
|
||||||
if (req?.app?.locals.logData?.sequence) {
|
if (req?.app?.locals.logData?.sequence) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
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 {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 255,
|
length: 255,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Entity, Column} from "typeorm";
|
import { Entity, Column } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
|
|
||||||
@Entity("educationLevel")
|
@Entity("educationLevel")
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
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 {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 255,
|
length: 255,
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ export class PosDict extends EntityBase {
|
||||||
comment: "ตำแหน่งทางการบริหาร",
|
comment: "ตำแหน่งทางการบริหาร",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
posExecutiveId?: string|null;
|
posExecutiveId?: string | null;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -101,7 +101,7 @@ export class CreatePosDict {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
isSpecial: boolean;
|
isSpecial: boolean;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
positionIsSelected?: boolean | null;
|
positionIsSelected?: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Entity, Column} from "typeorm";
|
import { Entity, Column } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
|
|
||||||
@Entity("prefixe")
|
@Entity("prefixe")
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
@ -226,7 +239,7 @@ export class ProfileItem {
|
||||||
organizationOld: string | null;
|
organizationOld: string | null;
|
||||||
organizationPositionOld?: string | null;
|
organizationPositionOld?: string | null;
|
||||||
amountOld: number | null;
|
amountOld: number | null;
|
||||||
educationOld: string | null;
|
educationOld: string | null;
|
||||||
rootOld: string | null;
|
rootOld: string | null;
|
||||||
rootOldId: string | null;
|
rootOldId: string | null;
|
||||||
rootShortNameOld: string | null;
|
rootShortNameOld: string | null;
|
||||||
|
|
@ -253,11 +266,11 @@ export class ProfileItem {
|
||||||
export type UpdateProfileChangePosition = {
|
export type UpdateProfileChangePosition = {
|
||||||
educationOld: string;
|
educationOld: string;
|
||||||
posMasterNoOld: number;
|
posMasterNoOld: number;
|
||||||
positionTypeOld: string;
|
positionTypeOld: string;
|
||||||
positionLevelOld: string;
|
positionLevelOld: string;
|
||||||
organizationPositionOld: string;
|
organizationPositionOld: string;
|
||||||
amountOld: number;
|
amountOld: number;
|
||||||
dateCurrent : Date;
|
dateCurrent: Date;
|
||||||
reason: string | null;
|
reason: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -275,4 +288,4 @@ export type SelectProfileChangePosition = {
|
||||||
posTypeName: string;
|
posTypeName: string;
|
||||||
posLevelId: string | null;
|
posLevelId: string | null;
|
||||||
posLevelName: string;
|
posLevelName: string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export class ProfileChildren extends EntityBase {
|
||||||
export type CreateProfileChildren = {
|
export type CreateProfileChildren = {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
childrenCareer: string | null;
|
childrenCareer: string | null;
|
||||||
childrenFirstName: string | null;
|
childrenFirstName: string | null;
|
||||||
childrenLastName: string | null;
|
childrenLastName: string | null;
|
||||||
childrenPrefix: string | null;
|
childrenPrefix: string | null;
|
||||||
childrenLive: boolean | null;
|
childrenLive: boolean | null;
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
@ -27,14 +27,13 @@ export class ProfileEmployeeEmployment extends EntityBase {
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
profileEmployeeId: string;
|
profileEmployeeId: string;
|
||||||
|
|
||||||
@ManyToOne(() => ProfileEmployee, (v) => v.profileEmployeeEmployment)
|
@ManyToOne(() => ProfileEmployee, (v) => v.profileEmployeeEmployment)
|
||||||
@JoinColumn({ name: "profileEmployeeId" })
|
@JoinColumn({ name: "profileEmployeeId" })
|
||||||
profileEmployee: ProfileEmployee;
|
profileEmployee: ProfileEmployee;
|
||||||
|
|
||||||
@OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment)
|
@OneToMany(() => ProfileEmployeeEmploymentHistory, (v) => v.profileEmployeeEmployment)
|
||||||
histories: ProfileEmployeeEmploymentHistory[];
|
histories: ProfileEmployeeEmploymentHistory[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateEmploymentProfileEmployee {
|
export class CreateEmploymentProfileEmployee {
|
||||||
|
|
@ -45,4 +44,4 @@ export class CreateEmploymentProfileEmployee {
|
||||||
export class UpdateEmploymentProfileEmployee {
|
export class UpdateEmploymentProfileEmployee {
|
||||||
date: Date | null;
|
date: Date | null;
|
||||||
command: string | null;
|
command: string | null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
@ -18,7 +18,7 @@ export class ProfileEmployeeEmploymentHistory extends EntityBase {
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
command: string;
|
command: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 40,
|
length: 40,
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,70 +4,69 @@ 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: "กลุ่มงาน",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
positionEmployeeGroupId: string;
|
positionEmployeeGroupId: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สายงาน",
|
comment: "สายงาน",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
positionEmployeeLineId: string;
|
positionEmployeeLineId: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ชื่อตำแหน่งทางสายงาน",
|
comment: "ชื่อตำแหน่งทางสายงาน",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
positionEmployeePositionId: string;
|
positionEmployeePositionId: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "สังกัด",
|
comment: "สังกัด",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
employeeOc: string;
|
employeeOc: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ประเภทบุคคล",
|
comment: "ประเภทบุคคล",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
employeeTypeIndividual: string;
|
employeeTypeIndividual: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ค่าจ้าง",
|
comment: "ค่าจ้าง",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
employeeWage: string;
|
employeeWage: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "เงินเพิ่มการครองชีพชั่วคราว",
|
comment: "เงินเพิ่มการครองชีพชั่วคราว",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
employeeMoneyIncrease: string;
|
employeeMoneyIncrease: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "เงินช่วยเหลือการครองชีพชั่วคราว",
|
comment: "เงินช่วยเหลือการครองชีพชั่วคราว",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
employeeMoneyAllowance: string;
|
employeeMoneyAllowance: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "เงินสมทบประกันสังคม(ลูกจ้าง)",
|
comment: "เงินสมทบประกันสังคม(ลูกจ้าง)",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
employeeMoneyEmployee: string;
|
employeeMoneyEmployee: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "เงินสมทบประกันสังคม(นายจ้าง)",
|
comment: "เงินสมทบประกันสังคม(นายจ้าง)",
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ export class ProfileFamilyCoupleHistory extends EntityBase {
|
||||||
comment: "มีชีวิตคู่สมรส",
|
comment: "มีชีวิตคู่สมรส",
|
||||||
})
|
})
|
||||||
coupleLive: boolean;
|
coupleLive: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ความสัมพันธ์",
|
comment: "ความสัมพันธ์",
|
||||||
|
|
@ -69,7 +69,7 @@ export class ProfileFamilyCoupleHistory extends EntityBase {
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
relationship: string;
|
relationship: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 40,
|
length: 40,
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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,9 +85,9 @@ 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;
|
||||||
motherPrefix: string | null;
|
motherPrefix: string | null;
|
||||||
motherFirstName: string | null;
|
motherFirstName: string | null;
|
||||||
|
|
@ -97,9 +95,9 @@ 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;
|
||||||
motherFirstName: string | null;
|
motherFirstName: string | null;
|
||||||
motherLastName: string | null;
|
motherLastName: string | null;
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
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 {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 255,
|
length: 255,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Entity, Column} from "typeorm";
|
import { Entity, Column } from "typeorm";
|
||||||
import { EntityBase } from "./base/Base";
|
import { EntityBase } from "./base/Base";
|
||||||
|
|
||||||
@Entity("rank")
|
@Entity("rank")
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export class CreateSubDistrict {
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
districtId: string;
|
districtId: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
zipCode: string;
|
zipCode: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
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 {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 255,
|
length: 255,
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export function calculateRetireDate(birthDate: Date) {
|
||||||
var year = d.getFullYear();
|
var year = d.getFullYear();
|
||||||
var month = d.getMonth();
|
var month = d.getMonth();
|
||||||
var day = d.getDate();
|
var day = d.getDate();
|
||||||
var c = new Date(year + 60, month, day-1);
|
var c = new Date(year + 60, month, day - 1);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
export function calculateRetireLaw(birthDate: Date) {
|
export function calculateRetireLaw(birthDate: Date) {
|
||||||
|
|
@ -94,8 +94,8 @@ export function calculateRetireYear(birthDate: Date) {
|
||||||
|
|
||||||
return yy + 61;
|
return yy + 61;
|
||||||
}
|
}
|
||||||
export async function removeProfileInOrganize(profileId: string, type:string) {
|
export async function removeProfileInOrganize(profileId: string, type: string) {
|
||||||
const currentRevision = await AppDataSource.getRepository(OrgRevision)
|
const currentRevision = await AppDataSource.getRepository(OrgRevision)
|
||||||
.createQueryBuilder("orgRevision")
|
.createQueryBuilder("orgRevision")
|
||||||
.where("orgRevision.orgRevisionIsDraft = false")
|
.where("orgRevision.orgRevisionIsDraft = false")
|
||||||
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
||||||
|
|
@ -110,7 +110,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
|
||||||
.where("posMaster.orgRevisionId = :orgRevisionId", { orgRevisionId: currentRevision?.id })
|
.where("posMaster.orgRevisionId = :orgRevisionId", { orgRevisionId: currentRevision?.id })
|
||||||
.andWhere("posMaster.current_holderId = :profileId", { profileId })
|
.andWhere("posMaster.current_holderId = :profileId", { profileId })
|
||||||
.getOne();
|
.getOne();
|
||||||
|
|
||||||
await AppDataSource.getRepository(PosMaster)
|
await AppDataSource.getRepository(PosMaster)
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.update(PosMaster)
|
.update(PosMaster)
|
||||||
|
|
@ -136,7 +136,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
|
||||||
.where("id IN (:...ids)", { ids: findPosition.map((item) => item.id) })
|
.where("id IN (:...ids)", { ids: findPosition.map((item) => item.id) })
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
if (type === "EMPLOYEE") {
|
if (type === "EMPLOYEE") {
|
||||||
const findProfileInEmpPosMaster = await AppDataSource.getRepository(EmployeePosMaster)
|
const findProfileInEmpPosMaster = await AppDataSource.getRepository(EmployeePosMaster)
|
||||||
.createQueryBuilder("employeePosMaster")
|
.createQueryBuilder("employeePosMaster")
|
||||||
.where("employeePosMaster.orgRevisionId = :orgRevisionId", {
|
.where("employeePosMaster.orgRevisionId = :orgRevisionId", {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.",
|
||||||
);
|
);
|
||||||
|
|
@ -60,11 +56,11 @@ export async function expressAuthentication(
|
||||||
if (!request.app.locals.logData) {
|
if (!request.app.locals.logData) {
|
||||||
request.app.locals.logData = {};
|
request.app.locals.logData = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
request.app.locals.logData.userId = payload.sub;
|
request.app.locals.logData.userId = payload.sub;
|
||||||
request.app.locals.logData.userName = payload.name;
|
request.app.locals.logData.userName = payload.name;
|
||||||
request.app.locals.logData.user = payload.preferred_username;
|
request.app.locals.logData.user = payload.preferred_username;
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function error(error: Error, _req: Request, res: Response, _next: NextFunction)
|
||||||
logData.status = "error";
|
logData.status = "error";
|
||||||
logData.description = error.message;
|
logData.description = error.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error instanceof HttpError) {
|
if (error instanceof HttpError) {
|
||||||
return res.status(error.status).json({
|
return res.status(error.status).json({
|
||||||
status: error.status,
|
status: error.status,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
|
||||||
res.on("finish", () => {
|
res.on("finish", () => {
|
||||||
if (!req.url.startsWith("/api/")) return;
|
if (!req.url.startsWith("/api/")) return;
|
||||||
let system = "organization";
|
let system = "organization";
|
||||||
if (req.url.startsWith("/api/v1/org/metadata/")) system="metadata";
|
if (req.url.startsWith("/api/v1/org/metadata/")) system = "metadata";
|
||||||
if (req.url.startsWith("/api/v1/org/auth/authRoleAttr/")) system = "admin";
|
if (req.url.startsWith("/api/v1/org/auth/authRoleAttr/")) system = "admin";
|
||||||
if (req.url.startsWith("/api/v1/org/profile/")) system = "registry";
|
if (req.url.startsWith("/api/v1/org/profile/")) system = "registry";
|
||||||
if (req.url.startsWith("/api/v1/org/profile-employee/")) system = "registry";
|
if (req.url.startsWith("/api/v1/org/profile-employee/")) system = "registry";
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
161
tsoa.json
161
tsoa.json
|
|
@ -26,75 +26,98 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"name": "Organization", "description": "โครงสร้างส่วนอื่น ๆ"
|
"name": "Organization",
|
||||||
},
|
"description": "โครงสร้างส่วนอื่น ๆ"
|
||||||
{
|
},
|
||||||
"name": "OrgRoot", "description": "โครงสร้างระดับ root"
|
{
|
||||||
},
|
"name": "OrgRoot",
|
||||||
{
|
"description": "โครงสร้างระดับ root"
|
||||||
"name": "OrgChild1", "description": "โครงสร้างระดับ 1"
|
},
|
||||||
},
|
{
|
||||||
{
|
"name": "OrgChild1",
|
||||||
"name": "OrgChild2", "description": "โครงสร้างระดับ 2"
|
"description": "โครงสร้างระดับ 1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OrgChild3", "description": "โครงสร้างระดับ 3"
|
"name": "OrgChild2",
|
||||||
},
|
"description": "โครงสร้างระดับ 2"
|
||||||
{
|
},
|
||||||
"name": "OrgChild4", "description": "โครงสร้างระดับ 4"
|
{
|
||||||
},
|
"name": "OrgChild3",
|
||||||
{
|
"description": "โครงสร้างระดับ 3"
|
||||||
"name": "Position", "description": "ตำแหน่ง"
|
},
|
||||||
},
|
{
|
||||||
{
|
"name": "OrgChild4",
|
||||||
"name": "PosType", "description": "ประเภทตำแหน่ง"
|
"description": "โครงสร้างระดับ 4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PosLevel", "description": "ระดับตำแหน่ง"
|
"name": "Position",
|
||||||
},
|
"description": "ตำแหน่ง"
|
||||||
{
|
},
|
||||||
"name": "PosExecutive", "description": "ตำแหน่งทางการบริหาร"
|
{
|
||||||
},
|
"name": "PosType",
|
||||||
{
|
"description": "ประเภทตำแหน่ง"
|
||||||
"name": "Prefix", "description": "คำนำหน้า"
|
},
|
||||||
},
|
{
|
||||||
{
|
"name": "PosLevel",
|
||||||
"name": "Rank", "description": "ยศ"
|
"description": "ระดับตำแหน่ง"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "BloodGroup", "description": "กลุ่มเลือด"
|
"name": "PosExecutive",
|
||||||
},
|
"description": "ตำแหน่งทางการบริหาร"
|
||||||
{
|
},
|
||||||
"name": "Gender", "description": "เพศ"
|
{
|
||||||
},
|
"name": "Prefix",
|
||||||
{
|
"description": "คำนำหน้า"
|
||||||
"name": "Religion", "description": "ศาสนา"
|
},
|
||||||
},
|
{
|
||||||
{
|
"name": "Rank",
|
||||||
"name": "Relationship", "description": "สถานภาพ"
|
"description": "ยศ"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "EducationLevel", "description": "ระดับการศึกษา"
|
"name": "BloodGroup",
|
||||||
},
|
"description": "กลุ่มเลือด"
|
||||||
{
|
},
|
||||||
"name": "OrganizationUnauthorize", "description": "โครงสร้างส่วนอื่น ๆ (Unauthorize)"
|
{
|
||||||
},
|
"name": "Gender",
|
||||||
{
|
"description": "เพศ"
|
||||||
"name": "Employee", "description": "ตำแหน่งลูกจ้างประจำ"
|
},
|
||||||
},
|
{
|
||||||
{
|
"name": "Religion",
|
||||||
"name": "EmployeePosType", "description": "กลุ่มงานลูกจ้างประจำ"
|
"description": "ศาสนา"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "EmployeePosLevel", "description": "ระดับชั้นงานลูกจ้างประจำ"
|
"name": "Relationship",
|
||||||
},
|
"description": "สถานภาพ"
|
||||||
{
|
},
|
||||||
"name": "InsigniaType", "description": "ลำดับชั้นเครื่องราชอิสริยาภรณ์"
|
{
|
||||||
},
|
"name": "EducationLevel",
|
||||||
{
|
"description": "ระดับการศึกษา"
|
||||||
"name": "Insignia", "description": "เครื่องราชอิสริยาภรณ์"
|
},
|
||||||
}
|
{
|
||||||
|
"name": "OrganizationUnauthorize",
|
||||||
|
"description": "โครงสร้างส่วนอื่น ๆ (Unauthorize)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Employee",
|
||||||
|
"description": "ตำแหน่งลูกจ้างประจำ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EmployeePosType",
|
||||||
|
"description": "กลุ่มงานลูกจ้างประจำ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EmployeePosLevel",
|
||||||
|
"description": "ระดับชั้นงานลูกจ้างประจำ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "InsigniaType",
|
||||||
|
"description": "ลำดับชั้นเครื่องราชอิสริยาภรณ์"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Insignia",
|
||||||
|
"description": "เครื่องราชอิสริยาภรณ์"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"routes": {
|
"routes": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue