add death to admin ui
This commit is contained in:
@ -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({})
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
|
Reference in New Issue
Block a user