This commit is contained in:
xCyanGrizzly
2026-02-18 14:26:36 +01:00
commit 3a5726e82b
167 changed files with 104081 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { z } from "zod/v4";
export const loginSchema = z.object({
email: z.email("Invalid email address"),
password: z.string().min(6, "Password must be at least 6 characters"),
});
export const registerSchema = z
.object({
name: z.string().min(2, "Name must be at least 2 characters"),
email: z.email("Invalid email address"),
password: z.string().min(6, "Password must be at least 6 characters"),
confirmPassword: z.string(),
})
.refine((data) => data.password === data.confirmPassword, {
message: "Passwords do not match",
path: ["confirmPassword"],
});
export type LoginInput = z.infer<typeof loginSchema>;
export type RegisterInput = z.infer<typeof registerSchema>;

View File

@@ -0,0 +1,21 @@
import { z } from "zod/v4";
import { MATERIALS } from "@/lib/constants";
export const filamentSchema = z.object({
name: z.string().min(1, "Name is required").max(128),
brand: z.string().min(1, "Brand is required").max(64),
material: z.enum(MATERIALS),
color: z.string().min(1, "Color name is required").max(64),
colorHex: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color"),
diameter: z.coerce.number().positive().default(1.75),
spoolWeight: z.coerce.number().positive("Spool weight must be positive"),
usedWeight: z.coerce.number().min(0).default(0),
emptySpoolWeight: z.coerce.number().min(0).default(0),
vendorId: z.string().optional().or(z.literal("")),
locationId: z.string().optional().or(z.literal("")),
purchaseDate: z.string().optional().or(z.literal("")),
cost: z.coerce.number().min(0).optional(),
notes: z.string().max(1024).optional(),
});
export type FilamentInput = z.output<typeof filamentSchema>;

View File

@@ -0,0 +1,8 @@
import { z } from "zod/v4";
export const locationSchema = z.object({
name: z.string().min(1, "Name is required").max(64),
description: z.string().max(256).optional(),
});
export type LocationInput = z.infer<typeof locationSchema>;

View File

@@ -0,0 +1,20 @@
import { z } from "zod/v4";
import { PAINT_FINISHES } from "@/lib/constants";
export const paintSchema = z.object({
name: z.string().min(1, "Name is required").max(128),
brand: z.string().min(1, "Brand is required").max(64),
line: z.string().max(64).optional().or(z.literal("")),
color: z.string().min(1, "Color name is required").max(64),
colorHex: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color"),
finish: z.enum(PAINT_FINISHES),
volumeML: z.coerce.number().positive("Volume must be positive"),
usedML: z.coerce.number().min(0).default(0),
vendorId: z.string().optional().or(z.literal("")),
locationId: z.string().optional().or(z.literal("")),
purchaseDate: z.string().optional().or(z.literal("")),
cost: z.coerce.number().min(0).optional(),
notes: z.string().max(1024).optional(),
});
export type PaintInput = z.output<typeof paintSchema>;

View File

@@ -0,0 +1,19 @@
import { z } from "zod/v4";
import { RESIN_TYPES } from "@/lib/constants";
export const resinSchema = z.object({
name: z.string().min(1, "Name is required").max(128),
brand: z.string().min(1, "Brand is required").max(64),
resinType: z.enum(RESIN_TYPES),
color: z.string().min(1, "Color name is required").max(64),
colorHex: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color"),
bottleSize: z.coerce.number().positive("Bottle size must be positive"),
usedML: z.coerce.number().min(0).default(0),
vendorId: z.string().optional().or(z.literal("")),
locationId: z.string().optional().or(z.literal("")),
purchaseDate: z.string().optional().or(z.literal("")),
cost: z.coerce.number().min(0).optional(),
notes: z.string().max(1024).optional(),
});
export type ResinInput = z.output<typeof resinSchema>;

View File

@@ -0,0 +1,11 @@
import { z } from "zod/v4";
import { CURRENCIES, UNITS } from "@/lib/constants";
export const settingsSchema = z.object({
lowStockThreshold: z.coerce.number().min(0).max(100).default(10),
currency: z.enum(CURRENCIES).default("USD"),
theme: z.enum(["dark", "light", "system"]).default("dark"),
units: z.enum(UNITS).default("metric"),
});
export type SettingsInput = z.output<typeof settingsSchema>;

View File

@@ -0,0 +1,8 @@
import { z } from "zod/v4";
export const usageLogSchema = z.object({
amount: z.coerce.number().positive("Amount must be positive"),
notes: z.string().max(512).optional(),
});
export type UsageLogInput = z.output<typeof usageLogSchema>;

View File

@@ -0,0 +1,9 @@
import { z } from "zod/v4";
export const vendorSchema = z.object({
name: z.string().min(1, "Name is required").max(64),
website: z.string().url().optional().or(z.literal("")),
notes: z.string().max(1024).optional(),
});
export type VendorInput = z.infer<typeof vendorSchema>;