1import { z } from "zod";
2
3export const RegisterDto = z.object({
4 name: z.string().min(1).max(100),
5 email: z.string().email().max(254),
6 password: z.string().min(8).max(72),
7 workspaceName: z.string().min(1).max(50).optional()
8});
9export type RegisterInput = z.infer<typeof RegisterDto>;
10
11export const LoginDto = z.object({
12 email: z.string().email().max(254),
13 password: z.string().min(1).max(72)
14});
15export type LoginInput = z.infer<typeof LoginDto>;
16
17export const RefreshDto = z.object({
18 refreshToken: z.string().min(10).optional()
19});
20export type RefreshInput = z.infer<typeof RefreshDto>;
21
22
23export const TwoFactorVerifyDto = z.object({
24 verificationId: z.string().min(10).max(128),
25 code: z.string().regex(/^\d{6}$/, { message: "code must be a 6-digit TOTP code" })
26});
27export type TwoFactorVerifyInput = z.infer<typeof TwoFactorVerifyDto>;
28
29export const LogoutDto = z.object({
30 sessionId: z.string().min(1).optional()
31});
32export type LogoutInput = z.infer<typeof LogoutDto>;
33
34export const ResetPasswordDto = z.object({
35 email: z.string().email().max(254)
36});
37export type ResetPasswordInput = z.infer<typeof ResetPasswordDto>;
38
39export const ResetPasswordConfirmDto = z.object({
40 email: z.string().email().max(254),
41 code: z.string().regex(/^\d{6}$/),
42 newPassword: z.string().min(8).max(72)
43});
44export type ResetPasswordConfirmInput = z.infer<typeof ResetPasswordConfirmDto>;
45