This commit is contained in:
@@ -84,5 +84,41 @@ export const user = {
|
||||
users: users
|
||||
};
|
||||
}
|
||||
}),
|
||||
addBlocked: defineAction({
|
||||
input: z.object({
|
||||
uuid: z.string(),
|
||||
comment: z.string().nullable()
|
||||
}),
|
||||
handler: async (input, context) => {
|
||||
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
|
||||
|
||||
const { id } = await db.addBlockedUser(input);
|
||||
|
||||
return {
|
||||
id: id
|
||||
};
|
||||
}
|
||||
}),
|
||||
editBlocked: defineAction({
|
||||
input: z.object({
|
||||
id: z.number(),
|
||||
uuid: z.string(),
|
||||
comment: z.string().nullable()
|
||||
}),
|
||||
handler: async (input, context) => {
|
||||
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
|
||||
|
||||
await db.editBlockedUser(input);
|
||||
}
|
||||
}),
|
||||
blocked: defineAction({
|
||||
handler: async (_, context) => {
|
||||
Session.actionSessionFromCookies(context.cookies, Permissions.Users);
|
||||
|
||||
return {
|
||||
blocked: await db.getBlockedUsers({})
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
|
Reference in New Issue
Block a user