import { FastifyRequest, FastifyReply } from 'fastify'; export const getBatches = async (request: FastifyRequest, reply: FastifyReply) => { const batches = await request.server.prisma.batch.findMany({ include: { room: true }, orderBy: { startDate: 'desc' } }); return batches; }; export const createBatch = async (request: FastifyRequest, reply: FastifyReply) => { const { name, strain, roomId, startDate } = request.body as any; const batch = await request.server.prisma.batch.create({ data: { name, strain, startDate: new Date(startDate), roomId } }); return batch; };