Spaces:
Runtime error
Runtime error
Download src/app/api/admin/validations.ts from shyota/better-chatbot: direct link, hf CLI and curl.
- Browser
- Download file 795 Bytes
-
https://huggingface.co/spaces/shyota/better-chatbot/resolve/main/src/app/api/admin/validations.ts
- Command line
-
hf download hf://spaces/shyota/better-chatbot/src/app/api/admin/validations.ts
-
curl -L -o validations.ts https://huggingface.co/spaces/shyota/better-chatbot/resolve/main/src/app/api/admin/validations.ts
795 Bytes
| import { z } from "zod"; | |
| import { USER_ROLES, UserRoleNames } from "app-types/roles"; | |
| import { ActionState } from "lib/action-utils"; | |
| import { BasicUserWithLastLogin } from "app-types/user"; | |
| export const UpdateUserRoleSchema = z.object({ | |
| userId: z.uuid("Invalid user ID"), | |
| role: z | |
| .enum(Object.values(USER_ROLES) as [UserRoleNames, ...UserRoleNames[]]) | |
| .optional(), | |
| }); | |
| export const UpdateUserBanStatusSchema = z.object({ | |
| userId: z.uuid("Invalid user ID"), | |
| banned: z.enum(["true", "false"]).transform((value) => value === "true"), | |
| banReason: z.string().optional(), | |
| }); | |
| export type UpdateUserRoleActionState = ActionState & { | |
| user?: BasicUserWithLastLogin | null; | |
| }; | |
| export type UpdateUserBanStatusActionState = ActionState & { | |
| user?: BasicUserWithLastLogin | null; | |
| }; | |