feat: sessão #3 — lib (db/auth/email/validations), API routes, NextAuth v5, middleware, páginas account/shelters/shelter-dashboard, Prisma v7 fix

This commit is contained in:
2026-05-21 09:01:59 +01:00
parent e6ebc0909c
commit e62dc9d6e6
44 changed files with 5341 additions and 273 deletions

View File

@@ -0,0 +1,35 @@
import { z } from 'zod';
export const createDonationSchema = z.discriminatedUnion('type', [
z.object({
type: z.literal('MONETARY'),
shelterId: z.string().cuid(),
details: z.object({
amount: z.number().min(1, 'Mínimo 1€.').max(10000),
currency: z.literal('EUR').default('EUR'),
deliveryMethod: z.literal('payment'),
}),
}),
z.object({
type: z.literal('FOOD'),
shelterId: z.string().cuid(),
details: z.object({
foodType: z.enum(['dry', 'wet']),
animalType: z.enum(['dog', 'cat']),
ageGroup: z.enum(['adult', 'puppy']),
deliveryMethod: z.enum(['pickup', 'home_delivery']),
address: z.string().max(200).optional(),
}),
}),
z.object({
type: z.literal('TOYS'),
shelterId: z.string().cuid(),
details: z.object({
category: z.enum(['chew', 'plush', 'interactive']),
deliveryMethod: z.enum(['pickup', 'home_delivery']),
address: z.string().max(200).optional(),
}),
}),
]);
export type CreateDonationInput = z.infer<typeof createDonationSchema>;