From 6bca6c5ba5bd1ba2ddfd1cd3613d9631ea6a67ca Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 28 Feb 2024 13:59:03 +0700 Subject: [PATCH] no message --- src/controllers/SalaryPeriodController.ts | 6 +++++- src/entities/SalaryProfile.ts | 18 ++++++++++++++++++ src/interfaces/call-api.ts | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 83035d0..8257c25 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -776,7 +776,11 @@ export class SalaryPeriodController extends Controller { await this.salaryProfileRepository.remove(salaryProfile); let orgs = await new CallAPI().GetData(request, "org/active/root/id"); - let orgProfiles = await new CallAPI().GetData(request, "org/profile/salary/gen"); + let orgProfiles = await new CallAPI().PostData(request, "org/profile/salary/gen", { + page: 1, + pageSize: 100, + keyword: "", + }); let revisionId = await new CallAPI().GetData(request, "org/revision/latest"); salaryPeriod.revisionId = revisionId; diff --git a/src/entities/SalaryProfile.ts b/src/entities/SalaryProfile.ts index 41bfcdb..ff93597 100644 --- a/src/entities/SalaryProfile.ts +++ b/src/entities/SalaryProfile.ts @@ -309,6 +309,9 @@ export class CreateSalaryProfile { @Column() posLevel: string; + @Column() + posExecutive: string; + @Column() amount: number; @@ -341,4 +344,19 @@ export class CreateSalaryProfile { @Column() child4: string; + + @Column() + isResult: boolean; + + @Column() + isDuration: boolean; + + @Column() + isPunish: boolean; + + @Column() + isRetired: boolean; + + @Column() + isRetired2: boolean; } diff --git a/src/interfaces/call-api.ts b/src/interfaces/call-api.ts index ddf535e..579e386 100644 --- a/src/interfaces/call-api.ts +++ b/src/interfaces/call-api.ts @@ -30,6 +30,23 @@ class CallAPI { throw error; } } + //Post + public async PostData(request: any, @Path() path: any, sendData: any) { + const token = request.headers.authorization; + const url = process.env.ORG_API + path; + try { + const response = await axios.post(url, { + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/json", + }, + json: sendData, + }); + return response.data.result; + } catch (error) { + throw error; + } + } } export default CallAPI;