Initial commit: Lageplan v1.0 - Next.js 15.5, React 19
This commit is contained in:
38
src/lib/validations.ts
Normal file
38
src/lib/validations.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const loginSchema = z.object({
|
||||
email: z.string().email('Ungültige E-Mail-Adresse'),
|
||||
password: z.string().min(1, 'Passwort erforderlich'),
|
||||
})
|
||||
|
||||
export const projectSchema = z.object({
|
||||
title: z.string().min(1, 'Titel erforderlich').max(200, 'Titel zu lang'),
|
||||
location: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
einsatzleiter: z.string().optional(),
|
||||
journalfuehrer: z.string().optional(),
|
||||
mapCenter: z.object({
|
||||
lng: z.number(),
|
||||
lat: z.number(),
|
||||
}).optional(),
|
||||
mapZoom: z.number().min(1).max(22).optional(),
|
||||
})
|
||||
|
||||
export const featureSchema = z.object({
|
||||
type: z.string(),
|
||||
geometry: z.object({
|
||||
type: z.string(),
|
||||
coordinates: z.any(),
|
||||
}),
|
||||
properties: z.record(z.any()).optional(),
|
||||
})
|
||||
|
||||
export const iconUploadSchema = z.object({
|
||||
name: z.string().min(1, 'Name erforderlich').max(100, 'Name zu lang'),
|
||||
categoryId: z.string().uuid('Ungültige Kategorie'),
|
||||
})
|
||||
|
||||
export type LoginInput = z.infer<typeof loginSchema>
|
||||
export type ProjectInput = z.infer<typeof projectSchema>
|
||||
export type FeatureInput = z.infer<typeof featureSchema>
|
||||
export type IconUploadInput = z.infer<typeof iconUploadSchema>
|
||||
Reference in New Issue
Block a user