แก้ create เป็น update เมนูทะเบียนประวัติ
This commit is contained in:
parent
fde5f8d90a
commit
f281ea0bc2
61 changed files with 193 additions and 147 deletions
|
|
@ -1055,7 +1055,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Get("{id}")
|
||||
async detailProfile(@Path() id: string) {//ตสTEMP
|
||||
async detailProfile(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP"); //ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
|
|
@ -2069,11 +2070,12 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Put("position/{id}")
|
||||
async positionProfileEmployee(//ตสTEMP
|
||||
async positionProfileEmployee(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
@Body() body: UpdatePositionTempProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
if (body.posLevelId === "") body.posLevelId = null;
|
||||
if (body.posTypeId === "") body.posTypeId = null;
|
||||
|
||||
|
|
@ -2201,7 +2203,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Put("citizenId/{id}")
|
||||
async checkCitizenIdProfile(//ตสTEMP
|
||||
async checkCitizenIdProfile(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { citizenId: string },
|
||||
|
|
@ -2552,7 +2554,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("keycloak/position/{revisionId}")
|
||||
async getProfileByKeycloakByRevision(//ตสTEMP
|
||||
async getProfileByKeycloakByRevision(
|
||||
//ไม่แน่ใจTEMP
|
||||
@Path() revisionId: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
|
|
@ -2652,8 +2655,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ข้อมูลบุลคลที่มีอายุเกษียณราชการตามปี
|
||||
*
|
||||
*/
|
||||
@Get("profileid/retire/{year}")//ตสTEMP
|
||||
async getProfileByRetireYear(@Path() year: number) {
|
||||
@Get("profileid/retire/{year}")
|
||||
async getProfileByRetireYear(@Path() year: number, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profileEmployee")
|
||||
.leftJoinAndSelect("profileEmployee.posLevel", "posLevel")
|
||||
|
|
@ -2845,13 +2849,14 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ทะเบียนประวัติ
|
||||
*/
|
||||
@Post("leave/{id}")//ตสTEMP
|
||||
@Post("leave/{id}")
|
||||
async updateLeaveUser(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -2880,12 +2885,13 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Put("information/{profileEmployeeId}")//ตสTEMP
|
||||
@Put("information/{profileEmployeeId}")
|
||||
async ProfileEmployeeInformation(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() profileEmployeeId: string,
|
||||
@Body() body: UpdateInformationProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(request, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profileEmp = await this.profileRepo.findOneBy({ id: profileEmployeeId });
|
||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||
|
||||
|
|
@ -2912,8 +2918,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("information/{profileEmployeeId}")//ตสTEMP
|
||||
async getInformationById(@Path() profileEmployeeId: string) {
|
||||
@Get("information/{profileEmployeeId}")
|
||||
async getInformationById(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profileInformation = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -2942,8 +2949,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("information/history/{profileEmployeeId}")//ตสTEMP
|
||||
async getInformationHistory(@Path() profileEmployeeId: string) {
|
||||
@Get("information/history/{profileEmployeeId}")
|
||||
async getInformationHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profileInformation = await this.profileRepo.find({
|
||||
relations: {
|
||||
information_histories: true,
|
||||
|
|
@ -2983,8 +2991,12 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Get("employment/{profileEmployeeId}")//ตสTEMP
|
||||
async ProfileEmployeeEmployment(@Path() profileEmployeeId: string) {
|
||||
@Get("employment/{profileEmployeeId}")
|
||||
async ProfileEmployeeEmployment(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
// await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employment = await this.employmentRepository.find({
|
||||
where: { profileEmployeeId: profileEmployeeId },
|
||||
order: { createdAt: "ASC" },
|
||||
|
|
@ -3004,8 +3016,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Get("employment/id/{id}")//ตสTEMP
|
||||
async GetEmploymentById(@Path() id: string) {
|
||||
@Get("employment/id/{id}")
|
||||
async GetEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employment = await this.employmentRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -3019,8 +3032,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Get("employment/history/{id}")//ตสTEMP
|
||||
async GetHistoryEmploymentById(@Path() id: string) {
|
||||
@Get("employment/history/{id}")
|
||||
async GetHistoryEmploymentById(@Path() id: string, @Request() req: RequestWithUser) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employmentHistory = await this.employmentHistoryRepository.find({
|
||||
where: { profileEmployeeEmploymentId: id },
|
||||
order: { lastUpdatedAt: "ASC" },
|
||||
|
|
@ -3035,12 +3049,13 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} profileEmployeeId profileEmployeeId ทะเบียนประวัติลูกจ้างชั่วคราว
|
||||
*/
|
||||
@Post("employment/{profileEmployeeId}")//ตสTEMP
|
||||
@Post("employment/{profileEmployeeId}")
|
||||
async CreateEmployment(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Body() body: CreateEmploymentProfileEmployee,
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
// await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
});
|
||||
|
|
@ -3074,8 +3089,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Delete("employment/{id}")//ตสTEMP
|
||||
@Delete("employment/{id}")
|
||||
async DeleteEmployment(@Path() id: string) {
|
||||
// await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
await this.employmentHistoryRepository.delete({
|
||||
profileEmployeeEmploymentId: id,
|
||||
});
|
||||
|
|
@ -3094,12 +3110,13 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
*
|
||||
* @param {string} id Id ข้อมูลการจ้าง
|
||||
*/
|
||||
@Put("employment/{id}")//ตสTEMP
|
||||
@Put("employment/{id}")
|
||||
async UpdateEmployment(
|
||||
@Request() request: RequestWithUser,
|
||||
@Path() id: string,
|
||||
@Body() body: UpdateEmploymentProfileEmployee,
|
||||
) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const employment = await this.employmentRepository.findOneBy({ id });
|
||||
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -3127,8 +3144,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Post("report")//ตสTEMP
|
||||
@Post("report")
|
||||
async sendReport(@Request() request: RequestWithUser, @Body() requestBody: { id: string[] }) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profiles = await this.profileRepo.find({ where: { id: In(requestBody.id) } });
|
||||
|
||||
const _profiles = await Promise.all(
|
||||
|
|
@ -3151,7 +3169,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_038 - ออกคำสั่งลูกจ้าง (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Post("report/resume")//ตสTEMP
|
||||
@Post("report/resume")
|
||||
async doneReport(
|
||||
@Body()
|
||||
body: {
|
||||
|
|
@ -3167,6 +3185,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
// await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -3216,7 +3235,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ค้นหาข้อมูลทะเบียนประวัติที่ยังไม่เชื่อม keycloak
|
||||
*
|
||||
*/
|
||||
@Post("search-personal-no-keycloak")//ตสTEMP
|
||||
@Post("search-personal-no-keycloak")
|
||||
async getProfileBySearchKeywordNoKeyCloak(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
|
|
@ -3226,6 +3245,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
keyword?: string;
|
||||
},
|
||||
) {
|
||||
// await new permission().PermissionPost(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
let findProfile: any;
|
||||
let total: any;
|
||||
const skip = (page - 1) * pageSize;
|
||||
|
|
@ -3382,11 +3402,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
* @summary ORG_065 - ข้อมูลทะเบียนประวัติตาม profileid (ADMIN) #70
|
||||
*
|
||||
*/
|
||||
@Get("profileid/position/{id}")//ตสTEMP
|
||||
async getProfileByProfileid(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Path() id: string,
|
||||
) {
|
||||
@Get("profileid/position/{id}")
|
||||
async getProfileByProfileid(@Request() req: RequestWithUser, @Path() id: string) {
|
||||
// await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");//ไม่แน่ใจTEMP
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: id },
|
||||
relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue