mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 14:44:15 +00:00
chore: update packages
also migrate zod to v4
This commit is contained in:
parent
afb73ec3a6
commit
8b4842b584
20 changed files with 918 additions and 922 deletions
|
|
@ -5,39 +5,39 @@ import { z } from "zod";
|
|||
export const querySchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.min(2, { message: "Search query must be at least 2 characters long" })
|
||||
.max(64, { message: "Search query cannot be more than 64 characters long" })
|
||||
.min(2, { error: "Search query must be at least 2 characters long" })
|
||||
.max(64, { error: "Search query cannot be more than 64 characters long" })
|
||||
.regex(/^[a-zA-Z0-9-_. ']+$/, {
|
||||
message: "Search query can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
error: "Search query can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
});
|
||||
|
||||
// Miis
|
||||
export const nameSchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.min(2, { message: "Name must be at least 2 characters long" })
|
||||
.max(64, { message: "Name cannot be more than 64 characters long" })
|
||||
.min(2, { error: "Name must be at least 2 characters long" })
|
||||
.max(64, { error: "Name cannot be more than 64 characters long" })
|
||||
.regex(/^[a-zA-Z0-9-_. ']+$/, {
|
||||
message: "Name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
error: "Name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
});
|
||||
|
||||
export const tagsSchema = z
|
||||
.array(
|
||||
z
|
||||
.string()
|
||||
.min(2, { message: "Tags must be at least 2 characters long" })
|
||||
.max(64, { message: "Tags cannot be more than 20 characters long" })
|
||||
.min(2, { error: "Tags must be at least 2 characters long" })
|
||||
.max(64, { error: "Tags cannot be more than 20 characters long" })
|
||||
.regex(/^[a-z0-9-_]+$/, {
|
||||
message: "Tags can only contain lowercase letters, numbers, dashes, and underscores.",
|
||||
error: "Tags can only contain lowercase letters, numbers, dashes, and underscores.",
|
||||
})
|
||||
)
|
||||
.min(1, { message: "There must be at least 1 tag" })
|
||||
.max(8, { message: "There cannot be more than 8 tags" });
|
||||
.min(1, { error: "There must be at least 1 tag" })
|
||||
.max(8, { error: "There cannot be more than 8 tags" });
|
||||
|
||||
export const idSchema = z.coerce
|
||||
.number({ message: "ID must be a number" })
|
||||
.int({ message: "ID must be an integer" })
|
||||
.positive({ message: "ID must be valid" });
|
||||
.number({ error: "ID must be a number" })
|
||||
.int({ error: "ID must be an integer" })
|
||||
.positive({ error: "ID must be valid" });
|
||||
|
||||
// Account Info
|
||||
export const usernameSchema = z
|
||||
|
|
@ -50,8 +50,8 @@ export const usernameSchema = z
|
|||
export const displayNameSchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.min(2, { message: "Display name must be at least 2 characters long" })
|
||||
.max(64, { message: "Display name cannot be more than 64 characters long" })
|
||||
.min(2, { error: "Display name must be at least 2 characters long" })
|
||||
.max(64, { error: "Display name cannot be more than 64 characters long" })
|
||||
.regex(/^[a-zA-Z0-9-_. ']+$/, {
|
||||
message: "Display name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
error: "Display name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue