diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index ccfa676d..935223fd 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -129,37 +129,12 @@ export class KeycloakController extends Controller { } @Delete("user/{userId}") - @Security("bearerAuth", ["system", "admin"]) async deleteUser(@Path() userId: string) { - return await deleteUser(userId).then(async (v) => { - if (!v) throw new Error("ไม่สามารถติดต่อกับระบบจัดการผู้ใช้งานได้"); - // await elasticsearch.deleteByQuery({ - // index: DEFAULT_INDEX, - // query: { - // bool: { - // must: [ - // { prefix: { pathname: stripLeadingSlash(`${userId}/`) } }, - // { match: { type: "folder" } }, - // ], - // }, - // }, - // }); - // delete file that is not uploaded - // await elasticsearch.deleteByQuery({ - // index: DEFAULT_INDEX, - // query: { - // bool: { - // must: [ - // { prefix: { pathname: stripLeadingSlash(`${userId}/`) } }, - // { match: { upload: false } }, - // ], - // }, - // }, - // }); - - // io.getInstance()?.emit("FolderDelete", { pathname: userId + "/" }); - }); + const result = await deleteUser(userId); + if (!result) throw new Error("Failed. Cannot delete userId."); } + // @Security("bearerAuth", ["system", "admin"]) + @Get("role") async getRole() { diff --git a/src/keycloak/index.ts b/src/keycloak/index.ts index da953e9f..61d54851 100644 --- a/src/keycloak/index.ts +++ b/src/keycloak/index.ts @@ -139,8 +139,6 @@ export async function getUserList(search = "") { return Boolean(console.error("Keycloak Error Response: ", await res.json())); } - console.log(res.json); - return ((await res.json()) as any[]).map((v: Record) => ({ id: v.id, username: v.username,