mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-10 21:28:51 +00:00
16 lines
717 B
TypeScript
16 lines
717 B
TypeScript
// src/schemas/userSchemas.ts
|
|
import { z } from "zod";
|
|
|
|
export const userRegistrationSchema = z.object({
|
|
username: z.string().regex(/^\S*$/, "Username must not contain spaces"), // No whitespaces allowed,
|
|
email: z.string().email("Invalid email address"),
|
|
password: z.string().min(8, "Password must be at least 8 characters long"),
|
|
});
|
|
|
|
export const userLoginSchema = z.object({
|
|
username: z.string().regex(/^\S*$/, "Username must not contain spaces"), // No whitespaces allowed,
|
|
password: z.string().min(1, "Password is required"),
|
|
});
|
|
// DTO-Typen aus den Schemas ableiten
|
|
export type UserRegistrationDto = z.infer<typeof userRegistrationSchema>;
|
|
export type UserLoginDto = z.infer<typeof userLoginSchema>;
|