add delete to admin panel
All checks were successful
deploy / build-and-deploy (push) Successful in 21s

This commit is contained in:
2025-05-21 20:53:53 +02:00
parent e47268111a
commit 45f984e4da
16 changed files with 207 additions and 50 deletions

View File

@@ -33,6 +33,16 @@ export const admin = {
await db.editAdmin(input);
}
}),
deleteAdmin: defineAction({
input: z.object({
id: z.number()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Admin);
await db.deleteAdmin(input);
}
}),
admins: defineAction({
handler: async (_, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Admin);

View File

@@ -105,6 +105,16 @@ export const team = {
});
}
}),
deleteTeam: defineAction({
input: z.object({
id: z.number()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
await db.deleteTeam(input);
}
}),
teams: defineAction({
input: z.object({
name: z.string().nullish(),

View File

@@ -70,6 +70,16 @@ export const user = {
});
}
}),
deleteUser: defineAction({
input: z.object({
id: z.number()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
await db.deleteUser(input);
}
}),
users: defineAction({
input: z.object({
username: z.string().nullish(),
@@ -112,6 +122,16 @@ export const user = {
await db.editBlockedUser(input);
}
}),
deleteBlocked: defineAction({
input: z.object({
id: z.number()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
await db.deleteBlockedUser(input);
}
}),
blocked: defineAction({
handler: async (_, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);