no message
This commit is contained in:
parent
6856c0c33a
commit
b93fb6c1e5
2 changed files with 34 additions and 22 deletions
|
|
@ -27,6 +27,7 @@ import { PosType } from "../entities/PosType";
|
||||||
import { PosLevel } from "../entities/PosLevel";
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
import { Salarys } from "../entities/Salarys";
|
import { Salarys } from "../entities/Salarys";
|
||||||
import { SalaryRanks } from "../entities/SalaryRanks";
|
import { SalaryRanks } from "../entities/SalaryRanks";
|
||||||
|
import CallAPI from "../interfaces/call-api";
|
||||||
|
|
||||||
@Route("api/v1/salary/period")
|
@Route("api/v1/salary/period")
|
||||||
@Tags("Salary")
|
@Tags("Salary")
|
||||||
|
|
@ -774,9 +775,9 @@ export class SalaryPeriodController extends Controller {
|
||||||
await this.salaryOrgRepository.remove(salaryOrg);
|
await this.salaryOrgRepository.remove(salaryOrg);
|
||||||
await this.salaryProfileRepository.remove(salaryProfile);
|
await this.salaryProfileRepository.remove(salaryProfile);
|
||||||
|
|
||||||
let orgs: any;
|
let orgs = await new CallAPI().GetData(request, "org/active/root/id");
|
||||||
let orgProfiles: any;
|
let orgProfiles = await new CallAPI().GetData(request, "org/profile/salary/gen");
|
||||||
let revisionId: any;
|
let revisionId = await new CallAPI().GetData(request, "org/revision/latest");
|
||||||
|
|
||||||
salaryPeriod.revisionId = revisionId;
|
salaryPeriod.revisionId = revisionId;
|
||||||
await this.salaryPeriodRepository.save(salaryPeriod);
|
await this.salaryPeriodRepository.save(salaryPeriod);
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,35 @@
|
||||||
import { Controller, Request, Get, Post, Put, Delete, Patch, Route, Security, Tags, Path } from "tsoa";
|
import {
|
||||||
import axios from 'axios';
|
Controller,
|
||||||
|
Request,
|
||||||
|
Get,
|
||||||
|
Post,
|
||||||
|
Put,
|
||||||
|
Delete,
|
||||||
|
Patch,
|
||||||
|
Route,
|
||||||
|
Security,
|
||||||
|
Tags,
|
||||||
|
Path,
|
||||||
|
} from "tsoa";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
class CallAPI {
|
class CallAPI {
|
||||||
//Get
|
//Get
|
||||||
public async GetData(request: any, @Path() path: any) {
|
public async GetData(request: any, @Path() path: any) {
|
||||||
const token = request.headers.authorization;
|
const token = request.headers.authorization;
|
||||||
const url = process.env.ORG_API+path;
|
const url = process.env.ORG_API + path;
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(url, {
|
const response = await axios.get(url, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json'
|
"Content-Type": "application/json",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
return response.data;
|
return response.data.result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CallAPI;
|
export default CallAPI;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue