21 lines
805 B
TypeScript
21 lines
805 B
TypeScript
import { z } from "zod";
|
|
|
|
export const loginSchema = z.object({
|
|
email: z.string().email("Invalid email address"),
|
|
password: z.string().min(1, "Password is required"),
|
|
});
|
|
|
|
export const createUserSchema = z.object({
|
|
employeeId: z.string().min(1, "Employee ID is required"),
|
|
email: z.string().email("Invalid email address"),
|
|
name: z.string().min(1, "Name is required"),
|
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
role: z.enum(["TECHNICAL", "MANNING", "ACCOUNTS", "MANAGER", "SUPERUSER", "AUDITOR", "ADMIN"]),
|
|
});
|
|
|
|
export const updateUserSchema = createUserSchema
|
|
.omit({ password: true })
|
|
.extend({ password: z.string().min(8).optional() });
|
|
|
|
export type LoginInput = z.infer<typeof loginSchema>;
|
|
export type CreateUserInput = z.infer<typeof createUserSchema>;
|