no message
This commit is contained in:
parent
6c67e490ae
commit
c5e0fcc4f7
4 changed files with 54 additions and 1 deletions
|
|
@ -328,7 +328,7 @@ export class ImportDataController extends Controller {
|
||||||
.createQueryBuilder("profile")
|
.createQueryBuilder("profile")
|
||||||
.select(["profile.citizenId", "profile.id"])
|
.select(["profile.citizenId", "profile.id"])
|
||||||
.orderBy("profile.citizenId", "ASC")
|
.orderBy("profile.citizenId", "ASC")
|
||||||
.skip(0)
|
.skip(20000)
|
||||||
.take(10000)
|
.take(10000)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
// for (var i = 1; i <= total / BATCH_SIZE; i++) {
|
// for (var i = 1; i <= total / BATCH_SIZE; i++) {
|
||||||
|
|
@ -412,6 +412,11 @@ export class ImportDataController extends Controller {
|
||||||
profileSalary.orgChild1 = item.DIVISION_NAME;
|
profileSalary.orgChild1 = item.DIVISION_NAME;
|
||||||
profileSalary.orgChild2 = item.SECTION_NAME;
|
profileSalary.orgChild2 = item.SECTION_NAME;
|
||||||
profileSalary.orgChild3 = item.JOB_NAME;
|
profileSalary.orgChild3 = item.JOB_NAME;
|
||||||
|
if (item.DEPARTMENT_CODE == "50") {
|
||||||
|
profileSalary.orgRoot = item.DIVISION_NAME;
|
||||||
|
profileSalary.orgChild1 = item.SECTION_NAME;
|
||||||
|
profileSalary.orgChild2 = item.JOB_NAME;
|
||||||
|
}
|
||||||
profileSalary.mpCee = item.MP_CEE;
|
profileSalary.mpCee = item.MP_CEE;
|
||||||
const ORDER_MOVE_POSITION: any =
|
const ORDER_MOVE_POSITION: any =
|
||||||
item.ORDER_MOVE_POSITION == null || item.ORDER_MOVE_POSITION == ""
|
item.ORDER_MOVE_POSITION == null || item.ORDER_MOVE_POSITION == ""
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import {
|
||||||
getUserCount,
|
getUserCount,
|
||||||
enableStatus,
|
enableStatus,
|
||||||
getUserByUsername,
|
getUserByUsername,
|
||||||
|
changeUserPassword,
|
||||||
} from "../keycloak";
|
} from "../keycloak";
|
||||||
import { AppDataSource } from "../database/data-source";
|
import { AppDataSource } from "../database/data-source";
|
||||||
import { Profile } from "../entities/Profile";
|
import { Profile } from "../entities/Profile";
|
||||||
|
|
@ -812,4 +813,19 @@ export class KeycloakController extends Controller {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post("user/change-password")
|
||||||
|
async changeUserPassword(
|
||||||
|
@Request() request: { user: { sub: string; preferred_username: string } },
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
password: string;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const result = await changeUserPassword(request.user.sub, body.password);
|
||||||
|
if (!result) {
|
||||||
|
throw new Error("Failed. Cannot change password.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,13 @@ export class HR_POSITION_OFFICER {
|
||||||
})
|
})
|
||||||
DEPARTMENT_NAME: string;
|
DEPARTMENT_NAME: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "text",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
DEPARTMENT_CODE: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
|
||||||
|
|
@ -736,3 +736,28 @@ export async function removeUserGroup(userId: string, groupId: string) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to change user password
|
||||||
|
export async function changeUserPassword(userId: string, newPassword: string) {
|
||||||
|
try {
|
||||||
|
console.log(await getToken());
|
||||||
|
const res = await fetch(`${KC_URL}/admin/realms/${KC_REALMS}/users/${userId}/reset-password`, {
|
||||||
|
// prettier-ignore
|
||||||
|
headers: {
|
||||||
|
"authorization": `Bearer ${await getToken()}`,
|
||||||
|
"content-type": `application/json`,
|
||||||
|
},
|
||||||
|
method: "PUT",
|
||||||
|
body: JSON.stringify({
|
||||||
|
type: "password",
|
||||||
|
value: newPassword,
|
||||||
|
temporary: false, // Set to true if the user must reset their password on next login
|
||||||
|
}),
|
||||||
|
}).catch((e) => console.log("Keycloak Error: ", e));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error changing password:", error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue