import { Router } from 'express'; import { eq, getTableColumns } from 'drizzle-orm'; import multer from 'multer'; import { db } from '../db/client'; import { rabbits, litters } from '../db/schema'; import { toCamelCase, pick } from '../utils/case'; const router = Router(); // In-memory upload: import files are small (a herd of a few thousand rabbits is // well under a megabyte) and we parse the whole thing in one shot, so there's no // reason to spill to disk. 10 MB is a generous ceiling that still rejects a // pathological upload before we try to buffer it. const upload = multer({ storage: multer.memoryStorage(), limits: { fileSize: 10 * 1024 * 1024 }, }).single('file'); const VALID_SEX = new Set(['buck', 'doe', 'unknown']); const VALID_STATUS = new Set(['active', 'for_sale', 'on_hold', 'sold', 'deceased', 'other']); // Legacy Kindlebox (PHP app) numeric status codes → MyKindlebox status values. // Sourced from the old editrabbit.php status