Initial project structure and core files
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.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const z = require("zod")
|
||||
|
||||
module.exports = {
|
||||
GET: {
|
||||
query: z.object({
|
||||
username: z.string()
|
||||
.min(3)
|
||||
.max(16),
|
||||
serverId: z.string()
|
||||
.min(1),
|
||||
ip: z.string()
|
||||
.optional()
|
||||
}),
|
||||
error: {
|
||||
code: 204,
|
||||
message: "Ignored"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
const z = require("zod")
|
||||
|
||||
module.exports = {
|
||||
POST: {
|
||||
body: z.object({
|
||||
accessToken: z.string()
|
||||
.min(1, { message: "Access Token is required." }),
|
||||
selectedProfile: z.string()
|
||||
.length(32, { message: "Selected Profile must be a valid UUID without dashes." })
|
||||
.regex(/^[0-9a-fA-F]+$/, { message: "Selected Profile must be hexadecimal." }),
|
||||
serverId: z.string()
|
||||
.min(1, { message: "Server ID is required." })
|
||||
.max(42, { message: "Server ID is too long." })
|
||||
}),
|
||||
error: {
|
||||
code: 400,
|
||||
message: "Missing or invalid parameters.",
|
||||
errorFormat: "SessionError",
|
||||
errorName: "Forbidden"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
const z = require("zod")
|
||||
|
||||
module.exports = {
|
||||
GET: {
|
||||
params: z.object({
|
||||
uuid: z.string().length(32).regex(/^[0-9a-fA-F]+$/, { message: "Invalid UUID (no dashes expected)." })
|
||||
}),
|
||||
query: z.object({
|
||||
unsigned: z.enum(["true", "false"]).optional()
|
||||
}),
|
||||
error: {
|
||||
code: 204,
|
||||
message: "No content (UUID not found)"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user