d8785a964d
Every AGENT now gets an auto-generated API key on creation, shown once in a modal. AGENTs log in with password and authenticate to the API with X-Api-Key. pre-push.sql defensively migrates any residual SERVICE rows to AGENT before Prisma rewrites the enum. Goddard is no longer baked into the seed — create agents via Admin → Users. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
22 lines
678 B
TypeScript
22 lines
678 B
TypeScript
import { z } from 'zod';
|
|
import { roleSchema } from './enums';
|
|
|
|
export const createUserSchema = z.object({
|
|
username: z.string().min(1).max(50),
|
|
email: z.string().email(),
|
|
displayName: z.string().min(1).max(100),
|
|
password: z.string().min(8),
|
|
role: roleSchema.default('AGENT'),
|
|
});
|
|
|
|
export const updateUserSchema = z.object({
|
|
displayName: z.string().min(1).max(100).optional(),
|
|
email: z.string().email().optional(),
|
|
password: z.string().min(8).optional(),
|
|
role: roleSchema.optional(),
|
|
regenerateApiKey: z.boolean().optional(),
|
|
});
|
|
|
|
export type CreateUserInput = z.infer<typeof createUserSchema>;
|
|
export type UpdateUserInput = z.infer<typeof updateUserSchema>;
|