29 lines
870 B
JavaScript
29 lines
870 B
JavaScript
'use strict';
|
|
|
|
const { z } = require('zod');
|
|
|
|
const createUser = z.object({
|
|
username: z.string().min(1).max(64).regex(/^[a-zA-Z0-9_.-]+$/, 'Username may only contain letters, numbers, underscores, dots, and hyphens'),
|
|
email: z.string().email().optional(),
|
|
firstName: z.string().max(100).optional(),
|
|
lastName: z.string().max(100).optional(),
|
|
password: z.string().min(8).max(128),
|
|
role: z.enum(['Owner', 'Coach', 'Client']),
|
|
});
|
|
|
|
const updateProfile = z.object({
|
|
firstName: z.string().max(100).optional(),
|
|
lastName: z.string().max(100).optional(),
|
|
email: z.string().email().optional(),
|
|
}).strict();
|
|
|
|
const resetPassword = z.object({
|
|
newPassword: z.string().min(8).max(128),
|
|
});
|
|
|
|
const changeRole = z.object({
|
|
role: z.enum(['Owner', 'Coach', 'Client']),
|
|
});
|
|
|
|
module.exports = { createUser, updateProfile, resetPassword, changeRole };
|