mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: ability to update display name and username in profile settings
This commit is contained in:
parent
86c76df873
commit
8b8c9aaa4b
10 changed files with 156 additions and 38 deletions
|
|
@ -1,14 +1,5 @@
|
|||
import { z } from "zod";
|
||||
|
||||
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" })
|
||||
.regex(/^[a-zA-Z0-9-_. ']+$/, {
|
||||
message: "Name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
});
|
||||
|
||||
export const querySchema = z
|
||||
.string()
|
||||
.trim()
|
||||
|
|
@ -18,6 +9,16 @@ export const querySchema = z
|
|||
message: "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" })
|
||||
.regex(/^[a-zA-Z0-9-_. ']+$/, {
|
||||
message: "Name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
});
|
||||
|
||||
export const tagsSchema = z
|
||||
.array(
|
||||
z
|
||||
|
|
@ -30,3 +31,20 @@ export const tagsSchema = z
|
|||
)
|
||||
.min(1, { message: "There must be at least 1 tag" })
|
||||
.max(8, { message: "There cannot be more than 8 tags" });
|
||||
|
||||
// Account Info
|
||||
export const usernameSchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.min(3, "Username must be at least 3 characters long")
|
||||
.max(20, "Username cannot be more than 20 characters long")
|
||||
.regex(/^[a-zA-Z0-9_]+$/, "Username can only contain letters, numbers, and underscores");
|
||||
|
||||
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" })
|
||||
.regex(/^[a-zA-Z0-9-_. ']+$/, {
|
||||
message: "Display name can only contain letters, numbers, dashes, underscores, apostrophes, and spaces.",
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue