add death to admin ui
All checks were successful
deploy / build-and-deploy (/testvaro, /opt/website-test, website-test) (push) Successful in 14s
deploy / build-and-deploy (/varo, /opt/website, website) (push) Successful in 14s

This commit is contained in:
2025-06-25 16:08:03 +02:00
parent 7a0db65f78
commit 6789a65285
12 changed files with 296 additions and 9 deletions

View File

@ -128,5 +128,53 @@ export const team = {
teams: await db.getTeams(input)
};
}
}),
addDeath: defineAction({
input: z.object({
deadUserId: z.number(),
killerUserId: z.number().nullish(),
message: z.string()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
const { id } = await db.addDeath(input);
return {
id: id
};
}
}),
editDeath: defineAction({
input: z.object({
id: z.number(),
deadUserId: z.number(),
killerUserId: z.number().nullish(),
message: z.string()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
await db.editDeath(input);
}
}),
deleteDeath: defineAction({
input: z.object({
id: z.number()
}),
handler: async (input, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
await db.deleteDeath(input);
}
}),
deaths: defineAction({
handler: async (_, context) => {
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
return {
deaths: await db.getDeaths({})
};
}
})
};