import { z } from 'zod'; import { ZCurrentPasswordSchema, ZPasswordSchema } from '../auth-router/schema'; export const MAX_PROFILE_BIO_LENGTH = 256; export const ZFindUserSecurityAuditLogsSchema = z.object({ page: z.number().optional(), perPage: z.number().optional(), }); export const ZRetrieveUserByIdQuerySchema = z.object({ id: z.number().min(1), }); export const ZUpdateProfileMutationSchema = z.object({ name: z.string().min(1), signature: z.string(), }); export const ZUpdatePublicProfileMutationSchema = z.object({ bio: z.string().max(MAX_PROFILE_BIO_LENGTH).optional(), enabled: z.boolean().optional(), url: z .string() .trim() .toLowerCase() .min(1, { message: 'Please enter a valid username.' }) .regex(/^[a-z0-9-]+$/, { message: 'Username can only container alphanumeric characters and dashes.', }) .optional(), }); export const ZUpdatePasswordMutationSchema = z.object({ currentPassword: ZCurrentPasswordSchema, password: ZPasswordSchema, }); export const ZForgotPasswordFormSchema = z.object({ email: z.string().email().min(1), }); export const ZResetPasswordFormSchema = z.object({ password: ZPasswordSchema, token: z.string().min(1), }); export const ZConfirmEmailMutationSchema = z.object({ email: z.string().email().min(1), }); export type TFindUserSecurityAuditLogsSchema = z.infer; export type TRetrieveUserByIdQuerySchema = z.infer; export type TUpdateProfileMutationSchema = z.infer; export type TUpdatePasswordMutationSchema = z.infer; export type TForgotPasswordFormSchema = z.infer; export type TResetPasswordFormSchema = z.infer; export type TConfirmEmailMutationSchema = z.infer;