Premier commit de la v2 de l'app

This commit is contained in:
UltraLionFr
2025-07-29 05:15:33 +02:00
parent 2f14898357
commit b593c60ab2
67 changed files with 5003 additions and 388 deletions
+10
View File
@@ -0,0 +1,10 @@
import fs from "node:fs/promises";
import path from "node:path";
const IMG_EXT = /\.(png|jpe?g|gif|webp|avif|svg)$/i;
export async function getAdFiles(): Promise<string[]> {
const dir = path.join(process.cwd(), "public", "ads");
const files = await fs.readdir(dir);
return files.filter((f) => IMG_EXT.test(f));
}
+13
View File
@@ -0,0 +1,13 @@
import { PrismaClient } from "@prisma/client";
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
log: ["error", "warn"],
});
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
+15
View File
@@ -0,0 +1,15 @@
import { z } from "zod";
export const projectSchema = z.object({
id: z.string().uuid(),
joueur: z.string(),
projet: z.string(),
description: z.string(),
coords: z.string().nullable(),
etat: z.enum(["En cours", "Terminé", "Pause"]),
monde: z.enum(["Overworld", "Nether", "End"]),
tags: z.array(z.string()),
createdAt: z.date().or(z.string().transform((s) => new Date(s))),
});
export type SafeProject = z.infer<typeof projectSchema>;