parent
8a96794e53
commit
0c523a55a4
4 changed files with 115 additions and 134 deletions
|
|
@ -62,6 +62,7 @@ import {
|
|||
getUserByUsername,
|
||||
getRoleMappings,
|
||||
removeUserRoles,
|
||||
getToken,
|
||||
} from "../keycloak";
|
||||
import { ProfileEducation, CreateProfileEducation } from "../entities/ProfileEducation";
|
||||
import { ProfileEducationHistory } from "../entities/ProfileEducationHistory";
|
||||
|
|
@ -1476,24 +1477,25 @@ export class CommandController extends Controller {
|
|||
}
|
||||
// @Get("XXX")
|
||||
async cronjobUpdateRetirementStatus(/*@Request() request: RequestWithUser*/) {
|
||||
let body = {
|
||||
client_id: "gettoken",
|
||||
client_secret: process.env.AUTH_ACCOUNT_SECRET,
|
||||
grant_type: "client_credentials",
|
||||
};
|
||||
const postData = querystring.stringify(body);
|
||||
const response = await axios.post(
|
||||
`${process.env.KC_URL}/realms/${process.env.KC_REALMS}/protocol/openid-connect/token`,
|
||||
postData,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
api_key: process.env.API_KEY,
|
||||
},
|
||||
},
|
||||
);
|
||||
const adminToken = response.data.access_token;
|
||||
// let body = {
|
||||
// client_id: "gettoken",
|
||||
// client_secret: process.env.AUTH_ACCOUNT_SECRET,
|
||||
// grant_type: "client_credentials",
|
||||
// };
|
||||
// const postData = querystring.stringify(body);
|
||||
// const response = await axios.post(
|
||||
// `${process.env.KC_URL}/realms/${process.env.KC_REALMS}/protocol/openid-connect/token`,
|
||||
// postData,
|
||||
// {
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded",
|
||||
// api_key: process.env.API_KEY,
|
||||
// },
|
||||
// },
|
||||
// );
|
||||
// const adminToken = response.data.access_token;
|
||||
// const adminToken = request.headers["authorization"]?.replace("Bearer ", "");
|
||||
const adminToken = await getToken() ?? "";
|
||||
const today = new Date();
|
||||
today.setUTCHours(0, 0, 0, 0);
|
||||
let type: string = "OFFICER";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue