This commit is contained in:
@@ -6,5 +6,18 @@ export const createArticleSchema = z.object({
|
||||
|
||||
export const updateArticleSchema = z.object({
|
||||
title: z.string().min(1).max(256),
|
||||
content: z.string().max(50000)
|
||||
slug: z.string().min(1).max(120),
|
||||
content: z.string().max(50000),
|
||||
tags: z.array(z.string().min(1).max(32)).max(8)
|
||||
});
|
||||
|
||||
export function parseArticleTags(value: string) {
|
||||
return [
|
||||
...new Set(
|
||||
value
|
||||
.split(',')
|
||||
.map((tag) => tag.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
// ── Presigned upload ──────────────────────────────────────────────────────────
|
||||
|
||||
export const presignedUploadSchema = z.object({
|
||||
mimeType: z.enum(['image/jpeg', 'image/png', 'image/webp', 'image/heic'])
|
||||
});
|
||||
|
||||
// ── Register new animal (+ first sighting) ────────────────────────────────────
|
||||
|
||||
export const registerAnimalSchema = z.object({
|
||||
@@ -29,7 +23,7 @@ export const registerAnimalSchema = z.object({
|
||||
deviceLat: z.number().min(-90).max(90),
|
||||
deviceLng: z.number().min(-180).max(180),
|
||||
|
||||
// Already-uploaded R2 keys (1–10 photos, browser uploaded directly)
|
||||
// Already-uploaded R2 keys (1–10 photos)
|
||||
photoKeys: z.array(z.string().min(1)).min(1).max(10)
|
||||
});
|
||||
|
||||
@@ -38,7 +32,7 @@ export type RegisterAnimalInput = z.infer<typeof registerAnimalSchema>;
|
||||
// ── Add sighting to existing animal ──────────────────────────────────────────
|
||||
|
||||
export const addSightingSchema = z.object({
|
||||
animalId: z.string().uuid(),
|
||||
animalId: z.coerce.number().int().positive(),
|
||||
reporterName: z.string().max(100).optional(),
|
||||
seenAt: z.iso.datetime(),
|
||||
lat: z.number().min(-90).max(90),
|
||||
|
||||
Reference in New Issue
Block a user