Files
homarr/packages/validation/src/user.ts
Meier Lukas fa19966fcc chore: restructure packages of the project (#7)
* chore: restructure validation package

* chore: move zod only to validation package

* chore: rename packages from alparr to homarr

* chore: move mantine core, dates and icons library to ui package, move most other mantine packages to seperate packages for further customization and centralization

* chore: fix formatting

* fix: wrong typecheck command in turbo generator

* chore: fix formatting

* chore: address pull request feedback

* chore: fix ci check issues
2024-01-02 14:18:37 +01:00

26 lines
564 B
TypeScript

import { z } from "zod";
const usernameSchema = z.string().min(3).max(255);
const passwordSchema = z.string().min(8).max(255);
const initUserSchema = z
.object({
username: usernameSchema,
password: passwordSchema,
confirmPassword: z.string(),
})
.refine((data) => data.password === data.confirmPassword, {
path: ["confirmPassword"],
message: "Passwords do not match",
});
const signInSchema = z.object({
name: z.string(),
password: z.string(),
});
export const userSchemas = {
signIn: signInSchema,
init: initUserSchema,
};