This commit is contained in:
@@ -1,34 +1 @@
|
||||
{
|
||||
"version": "5",
|
||||
"dialect": "sqlite",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "5",
|
||||
"when": 1713548458041,
|
||||
"tag": "0000_right_nebula",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "5",
|
||||
"when": 1713599233997,
|
||||
"tag": "0001_chilly_bullseye",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "5",
|
||||
"when": 1715319087385,
|
||||
"tag": "0002_gigantic_sentry",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "5",
|
||||
"when": 1715935487997,
|
||||
"tag": "0003_overconfident_spencer_smythe",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
{"version":"5","dialect":"sqlite","entries":[{"idx":0,"version":"5","when":1713548458041,"tag":"0000_right_nebula","breakpoints":true},{"idx":1,"version":"5","when":1713599233997,"tag":"0001_chilly_bullseye","breakpoints":true},{"idx":2,"version":"5","when":1715319087385,"tag":"0002_gigantic_sentry","breakpoints":true},{"idx":3,"version":"5","when":1715935487997,"tag":"0003_overconfident_spencer_smythe","breakpoints":true}]}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { router, publicProcedure } from "./trpc";
|
||||
import { db } from "./db";
|
||||
import { user } from "./schema";
|
||||
import { user, userOpinion } from "./schema";
|
||||
import { count, eq } from "drizzle-orm";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -29,7 +29,17 @@ export const adminRoute = router({
|
||||
removeUser: publicProcedure
|
||||
.input(z.object({ cid: z.string() }))
|
||||
.mutation(async ({ input }) => {
|
||||
let thisUser = await db.query.user
|
||||
.findFirst({ where: eq(user.cid, input.cid) })
|
||||
.execute();
|
||||
if (thisUser === undefined) {
|
||||
return "User not found";
|
||||
}
|
||||
let uoresult = await db
|
||||
.delete(userOpinion)
|
||||
.where(eq(userOpinion.userId, thisUser.id))
|
||||
.execute();
|
||||
let rs = await db.delete(user).where(eq(user.cid, input.cid)).execute();
|
||||
return rs;
|
||||
return { useropinion: uoresult, rs };
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user