Add base project files including environment example, license, README, .gitignore, error classes, ESLint config, database modules, texture assets, repositories, routes, schemas, services, and server entry point. This establishes the foundational structure for a Yggdrasil-compatible REST API with modular error handling, database setup, and route organization.
22 lines
576 B
JavaScript
22 lines
576 B
JavaScript
const z = require("zod")
|
|
|
|
const nameSchema = z.string()
|
|
.min(1)
|
|
.max(16)
|
|
.regex(/^[a-zA-Z0-9_]+$/, { message: "Name can only contain alphanumeric characters and underscores." });
|
|
|
|
module.exports = {
|
|
PUT: {
|
|
headers: z.object({
|
|
"authorization": z.string().min(1, { message: "Authorization header is required." })
|
|
}),
|
|
params: z.object({
|
|
name: nameSchema
|
|
}),
|
|
error: {
|
|
code: 400,
|
|
error: "CONSTRAINT_VIOLATION",
|
|
errorMessage: "Invalid profile name"
|
|
}
|
|
}
|
|
} |