gymco / src /modules /notifications /notifications.validation.js
moustafa7's picture
Upgrade gym SaaS workflows and Hugging Face CSP
2b109bf
Raw History Blame Contribute Delete
748 Bytes
import { z } from 'zod';
import { idParam, listQuery } from '../../common/validators/shared.js';
export const createNotificationSchema = z.object({
body: z.object({
memberId: z.string().uuid().nullable().optional(),
type: z.enum(['renewal', 'payment', 'reminder']),
channel: z.enum(['whatsapp', 'sms', 'email']),
message: z.string().min(2),
status: z.enum(['pending', 'sent', 'failed']).default('pending'),
}),
});
export const updateNotificationSchema = z.object({
...idParam.shape,
body: z.object({
status: z.enum(['pending', 'sent', 'failed']).optional(),
sentAt: z.coerce.date().nullable().optional(),
message: z.string().min(2).optional(),
}),
});
export const listNotificationsSchema = listQuery;