Spaces:
Paused
Paused
Download shared/src/admin/admin.schema.ts from Leon4gr45/augmenttoolkit: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/bb4da7e5d448e08c0375f8cfd152cb4fdc024f92/shared/src/admin/admin.schema.ts
- Command line
-
hf download hf://spaces/Leon4gr45/augmenttoolkit@bb4da7e5d448e08c0375f8cfd152cb4fdc024f92/shared/src/admin/admin.schema.ts
-
curl -L -o admin.schema.ts https://huggingface.co/spaces/Leon4gr45/augmenttoolkit/resolve/bb4da7e5d448e08c0375f8cfd152cb4fdc024f92/shared/src/admin/admin.schema.ts
1.34 kB
| import { z } from 'zod'; | |
| /** | |
| * Admin API contract for /api/admin (admin-only). | |
| * | |
| * The admin service validates most bodies itself (returning {error,status}), so | |
| * these schemas pin the well-defined ones: user create/update, the permission | |
| * matrix, invites and the boolean feature toggles. Free-form bodies (OIDC | |
| * settings, addon config, default user settings) stay with the service. | |
| */ | |
| export const adminUserCreateRequestSchema = z.object({ | |
| email: z.string(), | |
| password: z.string().optional(), | |
| username: z.string().optional(), | |
| role: z.enum(['user', 'admin']).optional(), | |
| }); | |
| export type AdminUserCreateRequest = z.infer< | |
| typeof adminUserCreateRequestSchema | |
| >; | |
| export const adminPermissionsRequestSchema = z.object({ | |
| permissions: z.record(z.string(), z.unknown()), | |
| }); | |
| export type AdminPermissionsRequest = z.infer< | |
| typeof adminPermissionsRequestSchema | |
| >; | |
| export const adminInviteCreateRequestSchema = z.object({ | |
| max_uses: z.number().optional(), | |
| expires_in_days: z.number().optional(), | |
| role: z.enum(['user', 'admin']).optional(), | |
| }); | |
| export type AdminInviteCreateRequest = z.infer< | |
| typeof adminInviteCreateRequestSchema | |
| >; | |
| export const adminFeatureToggleRequestSchema = z.object({ | |
| enabled: z.boolean(), | |
| }); | |
| export type AdminFeatureToggleRequest = z.infer< | |
| typeof adminFeatureToggleRequestSchema | |
| >; | |