adminActionController: delete user's events on suspend
This commit is contained in:
parent
5fdbd572f2
commit
229975a752
|
@ -114,6 +114,7 @@ const adminAccountActionSchema = z.object({
|
||||||
|
|
||||||
const adminActionController: AppController = async (c) => {
|
const adminActionController: AppController = async (c) => {
|
||||||
const body = await parseBody(c.req.raw);
|
const body = await parseBody(c.req.raw);
|
||||||
|
const store = await Storages.db();
|
||||||
const result = adminAccountActionSchema.safeParse(body);
|
const result = adminAccountActionSchema.safeParse(body);
|
||||||
const authorId = c.req.param('id');
|
const authorId = c.req.param('id');
|
||||||
|
|
||||||
|
@ -136,6 +137,7 @@ const adminActionController: AppController = async (c) => {
|
||||||
}
|
}
|
||||||
if (data.type === 'suspend') {
|
if (data.type === 'suspend') {
|
||||||
n.suspended = true;
|
n.suspended = true;
|
||||||
|
store.remove([{ authors: [authorId] }]).catch(console.warn);
|
||||||
}
|
}
|
||||||
|
|
||||||
await updateUser(authorId, n, c);
|
await updateUser(authorId, n, c);
|
||||||
|
|
Loading…
Reference in New Issue