create user

This commit is contained in:
kittapath 2025-03-05 12:18:24 +07:00
parent 7b2773f557
commit a7e9f78dae
5 changed files with 105 additions and 61 deletions

View file

@ -836,9 +836,9 @@ export class KeycloakController extends Controller {
@Request() request: { user: { sub: string; preferred_username: string } },
) {
const profiles = await this.profileRepo.find({
// where: {
// citizenId: "3640500632315",
// },
where: {
keycloak: IsNull(),
},
relations: ["roleKeycloaks"],
});
@ -872,7 +872,7 @@ export class KeycloakController extends Controller {
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
const result = await addUserRoles(
userId,
list.filter((v) => v.id == "f8619dc2-dc0d-4aab-957f-66bdf905e9d0"),
list.filter((v) => v.id == "8a1a0dc9-304c-4e5b-a90a-65f841048212"),
);
if (!result) {
@ -882,7 +882,7 @@ export class KeycloakController extends Controller {
_item.keycloak = userId;
}
const roleKeycloak = await this.roleKeycloakRepo.find({
where: { id: "f8619dc2-dc0d-4aab-957f-66bdf905e9d0" },
where: { id: "8a1a0dc9-304c-4e5b-a90a-65f841048212" },
});
if (_item) {
_item.roleKeycloaks = Array.from(new Set([..._item.roleKeycloaks, ...roleKeycloak]));