This commit is contained in:
AdisakKanthawilang 2024-06-13 17:38:01 +07:00
parent e6539edaec
commit 52e0141de4
3 changed files with 52 additions and 14 deletions

View file

@ -33,6 +33,7 @@ import {
import { AppDataSource } from "../database/data-source";
import { Profile } from "../entities/Profile";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { IsNull } from "typeorm";
// import * as io from "../lib/websocket";
// import elasticsearch from "../elasticsearch";
// import { StorageFolder } from "../interfaces/storage-fs";
@ -184,6 +185,17 @@ export class KeycloakController extends Controller {
async deleteUser(@Path() userId: string) {
const result = await deleteUser(userId);
if (!result) throw new Error("Failed. Cannot delete userId.");
const profile = await this.profileRepo.findOne({
where: {
id: userId,
},
});
if (profile) {
profile.keycloak = "";
await this.profileRepo.save(profile);
}
}
// @Security("bearerAuth", ["system", "admin"])