forked from pinks/eris
1
0
Fork 0

fix: withUser -> withAdmin #7

Merged
nameless merged 1 commits from admin-delete-fix into pr-main 2023-11-10 23:47:28 +00:00
1 changed files with 6 additions and 6 deletions

View File

@ -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 {