adminActionController: delete user's events on suspend

This commit is contained in:
Alex Gleason 2024-06-09 18:50:45 -05:00
parent 5fdbd572f2
commit 229975a752
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 0 deletions

View File

@ -114,6 +114,7 @@ const adminAccountActionSchema = z.object({
const adminActionController: AppController = async (c) => {
const body = await parseBody(c.req.raw);
const store = await Storages.db();
const result = adminAccountActionSchema.safeParse(body);
const authorId = c.req.param('id');
@ -136,6 +137,7 @@ const adminActionController: AppController = async (c) => {
}
if (data.type === 'suspend') {
n.suspended = true;
store.remove([{ authors: [authorId] }]).catch(console.warn);
}
await updateUser(authorId, n, c);