mirror of
https://github.com/arthur-pbty/binouz.git
synced 2026-06-03 23:36:27 +02:00
b7010a1704
- Implemented AuthButton component for Discord sign-in and sign-out functionality. - Created CopyButton component for copying server IP addresses. - Developed EventCard and GradeCard components for displaying events and grades. - Added Footer and Navbar components for site navigation and information. - Introduced PurchaseButton for handling grade purchases with Stripe integration. - Created SectionHeader component for consistent section titles. - Implemented session management with SessionProvider for NextAuth. - Set up PostgreSQL database with Docker and Prisma for data management. - Added admin guard functionality to restrict access to certain routes. - Configured NextAuth with Discord provider for user authentication. - Defined Prisma schema for user, admin, grade, event, and purchase models. - Seeded database with initial grades and events data. - Added SVG hero image for the landing page. - Extended NextAuth types to include additional user properties.
75 lines
1.6 KiB
JavaScript
75 lines
1.6 KiB
JavaScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
const db = new PrismaClient();
|
|
|
|
const grades = [
|
|
{
|
|
name: "Eclaireur",
|
|
price: 9,
|
|
description:
|
|
"Acces prioritaire, prefix colore, particules discretes et slots reserves.",
|
|
},
|
|
{
|
|
name: "Gladiateur",
|
|
price: 19,
|
|
description:
|
|
"Kit cosmetique PvP, tags exclusifs, bonus d'events et loot personnalise.",
|
|
},
|
|
{
|
|
name: "Titan",
|
|
price: 39,
|
|
description:
|
|
"Rang ultime, aura lumineuse, salons prives et avantages boutique VIP.",
|
|
},
|
|
];
|
|
|
|
const events = [
|
|
{
|
|
title: "UHC Arena - Duel Night",
|
|
description:
|
|
"Tournoi 1v1 avec bracket rapide. Score bonus pour les eliminations propres.",
|
|
eventDate: new Date("2026-05-18T19:00:00Z"),
|
|
},
|
|
{
|
|
title: "Rush 2v2 - Full PvP",
|
|
description:
|
|
"Arches, potions, clutchs. Inscription par equipe sur Discord.",
|
|
eventDate: new Date("2026-05-25T19:00:00Z"),
|
|
},
|
|
{
|
|
title: "UHC Royale",
|
|
description:
|
|
"Format 50 joueurs, shrink progressif, recompenses exclusives.",
|
|
eventDate: new Date("2026-06-01T19:00:00Z"),
|
|
},
|
|
];
|
|
|
|
const main = async () => {
|
|
for (const grade of grades) {
|
|
const existing = await db.grade.findFirst({
|
|
where: { name: grade.name },
|
|
});
|
|
if (!existing) {
|
|
await db.grade.create({ data: grade });
|
|
}
|
|
}
|
|
|
|
for (const event of events) {
|
|
const existing = await db.event.findFirst({
|
|
where: { title: event.title },
|
|
});
|
|
if (!existing) {
|
|
await db.event.create({ data: event });
|
|
}
|
|
}
|
|
};
|
|
|
|
main()
|
|
.catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await db.$disconnect();
|
|
});
|