From 7818810db78e9110c24f62fe6fa2c4d79472d104 Mon Sep 17 00:00:00 2001 From: nameless Date: Thu, 9 Nov 2023 23:21:21 +0000 Subject: [PATCH] fix: withUser -> withAdmin --- api/adminsRoute.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/adminsRoute.ts b/api/adminsRoute.ts index cb7fa3a..9666c7c 100644 --- a/api/adminsRoute.ts +++ b/api/adminsRoute.ts @@ -109,12 +109,12 @@ export const adminsRoute = createPathFilter({ }, }, async ({ params, query }) => { - const deletedAdminEntry = await adminStore.getById(params.adminId!); - if (!deletedAdminEntry) { - return { status: 404, body: { type: "text/plain", data: `Admin not found` } }; - } - const deletedAdminUser = await getUser(deletedAdminEntry.value.tgUserId); - return withUser(query, async (chat) => { + return withAdmin(query, async (chat) => { + const deletedAdminEntry = await adminStore.getById(params.adminId!); + if (!deletedAdminEntry) { + return { status: 404, body: { type: "text/plain", data: `Admin not found` } }; + } + const deletedAdminUser = await getUser(deletedAdminEntry.value.tgUserId); await deletedAdminEntry.delete(); info(`User ${chat.first_name} demoted user ${deletedAdminUser.first_name} from admin`); return {