Compare commits

..

2 Commits

24 changed files with 301 additions and 47 deletions

View File

@@ -20,6 +20,8 @@ export async function updateSitePreferences(data: {
eventsBackground?: string | null; eventsBackground?: string | null;
leaderboardBackground?: string | null; leaderboardBackground?: string | null;
challengesBackground?: string | null; challengesBackground?: string | null;
profileBackground?: string | null;
houseBackground?: string | null;
eventRegistrationPoints?: number; eventRegistrationPoints?: number;
eventFeedbackPoints?: number; eventFeedbackPoints?: number;
houseJoinPoints?: number; houseJoinPoints?: number;
@@ -34,6 +36,8 @@ export async function updateSitePreferences(data: {
eventsBackground: data.eventsBackground, eventsBackground: data.eventsBackground,
leaderboardBackground: data.leaderboardBackground, leaderboardBackground: data.leaderboardBackground,
challengesBackground: data.challengesBackground, challengesBackground: data.challengesBackground,
profileBackground: data.profileBackground,
houseBackground: data.houseBackground,
eventRegistrationPoints: data.eventRegistrationPoints, eventRegistrationPoints: data.eventRegistrationPoints,
eventFeedbackPoints: data.eventFeedbackPoints, eventFeedbackPoints: data.eventFeedbackPoints,
houseJoinPoints: data.houseJoinPoints, houseJoinPoints: data.houseJoinPoints,
@@ -46,6 +50,8 @@ export async function updateSitePreferences(data: {
revalidatePath("/events"); revalidatePath("/events");
revalidatePath("/leaderboard"); revalidatePath("/leaderboard");
revalidatePath("/challenges"); revalidatePath("/challenges");
revalidatePath("/profile");
revalidatePath("/houses");
return { success: true, data: preferences }; return { success: true, data: preferences };
} catch (error) { } catch (error) {

View File

@@ -128,3 +128,4 @@ export async function cancelChallenge(challengeId: string) {
} }
} }

View File

@@ -28,3 +28,4 @@ export async function GET() {
} }
} }

View File

@@ -13,6 +13,8 @@ export async function GET() {
eventsBackground: null, eventsBackground: null,
leaderboardBackground: null, leaderboardBackground: null,
challengesBackground: null, challengesBackground: null,
profileBackground: null,
houseBackground: null,
}); });
} }
@@ -21,6 +23,8 @@ export async function GET() {
eventsBackground: sitePreferences.eventsBackground, eventsBackground: sitePreferences.eventsBackground,
leaderboardBackground: sitePreferences.leaderboardBackground, leaderboardBackground: sitePreferences.leaderboardBackground,
challengesBackground: sitePreferences.challengesBackground, challengesBackground: sitePreferences.challengesBackground,
profileBackground: sitePreferences.profileBackground,
houseBackground: sitePreferences.houseBackground,
}); });
} catch (error) { } catch (error) {
console.error("Error fetching preferences:", error); console.error("Error fetching preferences:", error);
@@ -30,6 +34,8 @@ export async function GET() {
eventsBackground: null, eventsBackground: null,
leaderboardBackground: null, leaderboardBackground: null,
challengesBackground: null, challengesBackground: null,
profileBackground: null,
houseBackground: null,
}, },
{ status: 200 } { status: 200 }
); );

View File

@@ -40,3 +40,4 @@ export async function GET() {
} }
} }

View File

@@ -125,7 +125,7 @@ export default async function HousesPage() {
username: "asc", username: "asc",
}, },
}), }),
getBackgroundImage("challenges", "/got-2.jpg"), getBackgroundImage("houses", "/got-2.jpg"),
]); ]);
// Sérialiser les données pour le client // Sérialiser les données pour le client

View File

@@ -29,7 +29,7 @@ export default async function ProfilePage() {
score: true, score: true,
createdAt: true, createdAt: true,
}), }),
getBackgroundImage("home", "/got-background.jpg"), getBackgroundImage("profile", "/got-background.jpg"),
]); ]);
if (!user) { if (!user) {

View File

@@ -11,6 +11,8 @@ interface SitePreferences {
eventsBackground: string | null; eventsBackground: string | null;
leaderboardBackground: string | null; leaderboardBackground: string | null;
challengesBackground: string | null; challengesBackground: string | null;
profileBackground: string | null;
houseBackground: string | null;
eventRegistrationPoints?: number; eventRegistrationPoints?: number;
} }
@@ -23,6 +25,8 @@ const DEFAULT_IMAGES = {
events: "/got-2.jpg", events: "/got-2.jpg",
leaderboard: "/leaderboard-bg.jpg", leaderboard: "/leaderboard-bg.jpg",
challenges: "/got-2.jpg", challenges: "/got-2.jpg",
profile: "/got-background.jpg",
houses: "/got-2.jpg",
}; };
export default function BackgroundPreferences({ export default function BackgroundPreferences({
@@ -64,6 +68,14 @@ export default function BackgroundPreferences({
initialPreferences.challengesBackground, initialPreferences.challengesBackground,
DEFAULT_IMAGES.challenges DEFAULT_IMAGES.challenges
), ),
profileBackground: getFormValue(
initialPreferences.profileBackground,
DEFAULT_IMAGES.profile
),
houseBackground: getFormValue(
initialPreferences.houseBackground,
DEFAULT_IMAGES.houses
),
}), }),
[initialPreferences] [initialPreferences]
); );
@@ -101,6 +113,14 @@ export default function BackgroundPreferences({
formData.challengesBackground, formData.challengesBackground,
DEFAULT_IMAGES.challenges DEFAULT_IMAGES.challenges
), ),
profileBackground: getApiValue(
formData.profileBackground,
DEFAULT_IMAGES.profile
),
houseBackground: getApiValue(
formData.houseBackground,
DEFAULT_IMAGES.houses
),
}; };
const result = await updateSitePreferences(apiData); const result = await updateSitePreferences(apiData);
@@ -125,6 +145,14 @@ export default function BackgroundPreferences({
result.data.challengesBackground, result.data.challengesBackground,
DEFAULT_IMAGES.challenges DEFAULT_IMAGES.challenges
), ),
profileBackground: getFormValue(
result.data.profileBackground,
DEFAULT_IMAGES.profile
),
houseBackground: getFormValue(
result.data.houseBackground,
DEFAULT_IMAGES.houses
),
}); });
setIsEditing(false); setIsEditing(false);
} else { } else {
@@ -157,6 +185,14 @@ export default function BackgroundPreferences({
preferences.challengesBackground, preferences.challengesBackground,
DEFAULT_IMAGES.challenges DEFAULT_IMAGES.challenges
), ),
profileBackground: getFormValue(
preferences.profileBackground,
DEFAULT_IMAGES.profile
),
houseBackground: getFormValue(
preferences.houseBackground,
DEFAULT_IMAGES.houses
),
}); });
} }
}; };
@@ -226,6 +262,26 @@ export default function BackgroundPreferences({
} }
label="Background Challenges" label="Background Challenges"
/> />
<ImageSelector
value={formData.profileBackground}
onChange={(url) =>
setFormData({
...formData,
profileBackground: url,
})
}
label="Background Profile"
/>
<ImageSelector
value={formData.houseBackground}
onChange={(url) =>
setFormData({
...formData,
houseBackground: url,
})
}
label="Background Houses"
/>
<div className="flex flex-col sm:flex-row gap-2 pt-4"> <div className="flex flex-col sm:flex-row gap-2 pt-4">
<Button onClick={handleSave} variant="success" size="md"> <Button onClick={handleSave} variant="success" size="md">
Enregistrer Enregistrer
@@ -461,6 +517,118 @@ export default function BackgroundPreferences({
); );
})()} })()}
</div> </div>
<div className="flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4">
<span className="text-pixel-gold font-bold text-sm sm:text-base min-w-0 sm:min-w-[120px] flex-shrink-0">
Profile:
</span>
{(() => {
const currentImage =
preferences?.profileBackground &&
preferences.profileBackground.trim() !== ""
? preferences.profileBackground
: DEFAULT_IMAGES.profile;
const isDefault =
!preferences?.profileBackground ||
preferences.profileBackground.trim() === "";
return (
<div className="flex items-center gap-2 sm:gap-3 min-w-0 flex-1">
<div className="relative w-16 h-10 sm:w-20 sm:h-12 rounded border border-pixel-gold/30 overflow-hidden bg-black/60 flex-shrink-0">
<img
src={currentImage}
alt="Profile background"
className="w-full h-full object-cover"
onError={(e) => {
const target = e.currentTarget;
const currentSrc = target.src;
const fallbackSrc = "/got-background.jpg";
if (!currentSrc.includes(fallbackSrc)) {
target.src = fallbackSrc;
} else {
target.style.display = "none";
const fallbackDiv =
target.nextElementSibling as HTMLElement;
if (fallbackDiv) {
fallbackDiv.classList.remove("hidden");
}
}
}}
/>
<div className="absolute inset-0 flex items-center justify-center bg-black/60 text-gray-500 text-xs hidden">
No image
</div>
</div>
<div className="flex flex-col min-w-0 flex-1">
<span className="text-xs text-gray-400 truncate min-w-0">
{isDefault ? "Par défaut: " : ""}
{currentImage}
</span>
{isDefault && (
<span className="text-[10px] text-gray-500 italic">
(Image par défaut)
</span>
)}
</div>
</div>
);
})()}
</div>
<div className="flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4">
<span className="text-pixel-gold font-bold text-sm sm:text-base min-w-0 sm:min-w-[120px] flex-shrink-0">
Houses:
</span>
{(() => {
const currentImage =
preferences?.houseBackground &&
preferences.houseBackground.trim() !== ""
? preferences.houseBackground
: DEFAULT_IMAGES.houses;
const isDefault =
!preferences?.houseBackground ||
preferences.houseBackground.trim() === "";
return (
<div className="flex items-center gap-2 sm:gap-3 min-w-0 flex-1">
<div className="relative w-16 h-10 sm:w-20 sm:h-12 rounded border border-pixel-gold/30 overflow-hidden bg-black/60 flex-shrink-0">
<img
src={currentImage}
alt="Houses background"
className="w-full h-full object-cover"
onError={(e) => {
const target = e.currentTarget;
const currentSrc = target.src;
const fallbackSrc = "/got-2.jpg";
if (!currentSrc.includes(fallbackSrc)) {
target.src = fallbackSrc;
} else {
target.style.display = "none";
const fallbackDiv =
target.nextElementSibling as HTMLElement;
if (fallbackDiv) {
fallbackDiv.classList.remove("hidden");
}
}
}}
/>
<div className="absolute inset-0 flex items-center justify-center bg-black/60 text-gray-500 text-xs hidden">
No image
</div>
</div>
<div className="flex flex-col min-w-0 flex-1">
<span className="text-xs text-gray-400 truncate min-w-0">
{isDefault ? "Par défaut: " : ""}
{currentImage}
</span>
{isDefault && (
<span className="text-[10px] text-gray-500 italic">
(Image par défaut)
</span>
)}
</div>
</div>
);
})()}
</div>
</div> </div>
)} )}
</Card> </Card>

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { useEffect, useState, useTransition } from "react"; import { useState, useTransition } from "react";
import { import {
validateChallenge, validateChallenge,
rejectChallenge, rejectChallenge,
@@ -48,7 +48,6 @@ interface ChallengeManagementProps {
export default function ChallengeManagement({ initialChallenges }: ChallengeManagementProps) { export default function ChallengeManagement({ initialChallenges }: ChallengeManagementProps) {
const [challenges, setChallenges] = useState<Challenge[]>(initialChallenges); const [challenges, setChallenges] = useState<Challenge[]>(initialChallenges);
const [loading, setLoading] = useState(false);
const [selectedChallenge, setSelectedChallenge] = useState<Challenge | null>( const [selectedChallenge, setSelectedChallenge] = useState<Challenge | null>(
null null
); );
@@ -260,12 +259,6 @@ export default function ChallengeManagement({ initialChallenges }: ChallengeMana
}); });
}; };
if (loading) {
return (
<div className="text-center text-pixel-gold py-8">Chargement...</div>
);
}
if (challenges.length === 0) { if (challenges.length === 0) {
return <div className="text-center text-gray-400 py-8">Aucun défi</div>; return <div className="text-center text-gray-400 py-8">Aucun défi</div>;
} }

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { useState, useEffect, useTransition } from "react"; import { useState, useTransition } from "react";
import { calculateEventStatus } from "@/lib/eventStatus"; import { calculateEventStatus } from "@/lib/eventStatus";
import { createEvent, updateEvent, deleteEvent } from "@/actions/admin/events"; import { createEvent, updateEvent, deleteEvent } from "@/actions/admin/events";
import { import {
@@ -98,7 +98,6 @@ interface EventManagementProps {
export default function EventManagement({ initialEvents }: EventManagementProps) { export default function EventManagement({ initialEvents }: EventManagementProps) {
const [events, setEvents] = useState<Event[]>(initialEvents); const [events, setEvents] = useState<Event[]>(initialEvents);
const [loading, setLoading] = useState(false);
const [editingEvent, setEditingEvent] = useState<Event | null>(null); const [editingEvent, setEditingEvent] = useState<Event | null>(null);
const [isCreating, setIsCreating] = useState(false); const [isCreating, setIsCreating] = useState(false);
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
@@ -304,10 +303,6 @@ export default function EventManagement({ initialEvents }: EventManagementProps)
}); });
}; };
if (loading) {
return <div className="text-center text-gray-400 py-8">Chargement...</div>;
}
return ( return (
<div className="space-y-4"> <div className="space-y-4">
<div className="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3 mb-4"> <div className="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3 mb-4">

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { useState, useEffect } from "react"; import { useState } from "react";
import { import {
addFeedbackBonusPoints, addFeedbackBonusPoints,
markFeedbackAsRead, markFeedbackAsRead,
@@ -49,7 +49,6 @@ export default function FeedbackManagement({
}: FeedbackManagementProps) { }: FeedbackManagementProps) {
const [feedbacks, setFeedbacks] = useState<Feedback[]>(initialFeedbacks); const [feedbacks, setFeedbacks] = useState<Feedback[]>(initialFeedbacks);
const [statistics, setStatistics] = useState<EventStatistics[]>(initialStatistics); const [statistics, setStatistics] = useState<EventStatistics[]>(initialStatistics);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(""); const [error, setError] = useState("");
const [selectedEvent, setSelectedEvent] = useState<string | null>(null); const [selectedEvent, setSelectedEvent] = useState<string | null>(null);
const [addingPoints, setAddingPoints] = useState<Record<string, boolean>>( const [addingPoints, setAddingPoints] = useState<Record<string, boolean>>(
@@ -161,14 +160,6 @@ export default function FeedbackManagement({
); );
}); });
if (loading) {
return (
<div className="bg-black/60 border border-pixel-gold/30 rounded-lg p-4 sm:p-8">
<p className="text-gray-400 text-center text-sm">Chargement...</p>
</div>
);
}
return ( return (
<div className="space-y-4 sm:space-y-6"> <div className="space-y-4 sm:space-y-6">
{/* Statistiques par événement */} {/* Statistiques par événement */}

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { useState, useEffect, useTransition } from "react"; import { useState, useTransition } from "react";
import { import {
Input, Input,
Textarea, Textarea,
@@ -77,7 +77,6 @@ interface HouseManagementProps {
export default function HouseManagement({ initialHouses }: HouseManagementProps) { export default function HouseManagement({ initialHouses }: HouseManagementProps) {
const [houses, setHouses] = useState<House[]>(initialHouses); const [houses, setHouses] = useState<House[]>(initialHouses);
const [loading, setLoading] = useState(false);
const [editingHouse, setEditingHouse] = useState<House | null>(null); const [editingHouse, setEditingHouse] = useState<House | null>(null);
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
const [deletingHouseId, setDeletingHouseId] = useState<string | null>(null); const [deletingHouseId, setDeletingHouseId] = useState<string | null>(null);
@@ -216,10 +215,6 @@ export default function HouseManagement({ initialHouses }: HouseManagementProps)
return num.toLocaleString("en-US"); return num.toLocaleString("en-US");
}; };
if (loading) {
return <div className="text-center text-gray-400 py-8">Chargement...</div>;
}
return ( return (
<div className="space-y-4"> <div className="space-y-4">
<div className="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3 mb-4"> <div className="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3 mb-4">

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { useState, useEffect, useTransition } from "react"; import { useState, useTransition } from "react";
import { import {
Avatar, Avatar,
Input, Input,
@@ -43,7 +43,6 @@ interface UserManagementProps {
export default function UserManagement({ initialUsers }: UserManagementProps) { export default function UserManagement({ initialUsers }: UserManagementProps) {
const [users, setUsers] = useState<User[]>(initialUsers); const [users, setUsers] = useState<User[]>(initialUsers);
const [loading, setLoading] = useState(false);
const [editingUser, setEditingUser] = useState<EditingUser | null>(null); const [editingUser, setEditingUser] = useState<EditingUser | null>(null);
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
const [deletingUserId, setDeletingUserId] = useState<string | null>(null); const [deletingUserId, setDeletingUserId] = useState<string | null>(null);
@@ -183,10 +182,6 @@ export default function UserManagement({ initialUsers }: UserManagementProps) {
? Math.max(0, currentEditingUserData.xp + editingUser.xpDelta) ? Math.max(0, currentEditingUserData.xp + editingUser.xpDelta)
: 0; : 0;
if (loading) {
return <div className="text-center text-gray-400 py-8">Chargement...</div>;
}
return ( return (
<div className="space-y-4"> <div className="space-y-4">
{users.length === 0 ? ( {users.length === 0 ? (

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { ButtonHTMLAttributes, ReactNode, ElementType, AnchorHTMLAttributes } from "react"; import { ButtonHTMLAttributes, ReactNode, ElementType } from "react";
import Link from "next/link"; import Link from "next/link";
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & { type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {

View File

@@ -6,6 +6,8 @@ interface Preferences {
eventsBackground: string | null; eventsBackground: string | null;
leaderboardBackground: string | null; leaderboardBackground: string | null;
challengesBackground: string | null; challengesBackground: string | null;
profileBackground: string | null;
houseBackground: string | null;
} }
export function usePreferences() { export function usePreferences() {
@@ -23,6 +25,8 @@ export function usePreferences() {
eventsBackground: null, eventsBackground: null,
leaderboardBackground: null, leaderboardBackground: null,
challengesBackground: null, challengesBackground: null,
profileBackground: null,
houseBackground: null,
} }
); );
setLoading(false); setLoading(false);
@@ -33,6 +37,8 @@ export function usePreferences() {
eventsBackground: null, eventsBackground: null,
leaderboardBackground: null, leaderboardBackground: null,
challengesBackground: null, challengesBackground: null,
profileBackground: null,
houseBackground: null,
}); });
setLoading(false); setLoading(false);
}); });
@@ -42,7 +48,7 @@ export function usePreferences() {
} }
export function useBackgroundImage( export function useBackgroundImage(
page: "home" | "events" | "leaderboard" | "challenges", page: "home" | "events" | "leaderboard" | "challenges" | "profile" | "houses",
defaultImage: string defaultImage: string
) { ) {
const { preferences } = usePreferences(); const { preferences } = usePreferences();
@@ -51,7 +57,9 @@ export function useBackgroundImage(
useEffect(() => { useEffect(() => {
if (preferences) { if (preferences) {
const imageKey = `${page}Background` as keyof Preferences; // Mapping spécial pour "houses" -> "house" (car la colonne est houseBackground)
const dbPage = page === "houses" ? "house" : page;
const imageKey = `${dbPage}Background` as keyof Preferences;
const customImage = preferences[imageKey]; const customImage = preferences[imageKey];
const rawImage = customImage || defaultImage; const rawImage = customImage || defaultImage;
// Normaliser l'URL pour utiliser l'API si nécessaire // Normaliser l'URL pour utiliser l'API si nécessaire

View File

@@ -1,7 +1,7 @@
import { sitePreferencesService } from "@/services/preferences/site-preferences.service"; import { sitePreferencesService } from "@/services/preferences/site-preferences.service";
export async function getBackgroundImage( export async function getBackgroundImage(
page: "home" | "events" | "leaderboard" | "challenges", page: "home" | "events" | "leaderboard" | "challenges" | "profile" | "houses",
defaultImage: string defaultImage: string
): Promise<string> { ): Promise<string> {
return sitePreferencesService.getBackgroundImage(page, defaultImage); return sitePreferencesService.getBackgroundImage(page, defaultImage);

File diff suppressed because one or more lines are too long

View File

@@ -1349,6 +1349,8 @@ export const SitePreferencesScalarFieldEnum = {
eventsBackground: 'eventsBackground', eventsBackground: 'eventsBackground',
leaderboardBackground: 'leaderboardBackground', leaderboardBackground: 'leaderboardBackground',
challengesBackground: 'challengesBackground', challengesBackground: 'challengesBackground',
profileBackground: 'profileBackground',
houseBackground: 'houseBackground',
eventRegistrationPoints: 'eventRegistrationPoints', eventRegistrationPoints: 'eventRegistrationPoints',
eventFeedbackPoints: 'eventFeedbackPoints', eventFeedbackPoints: 'eventFeedbackPoints',
houseJoinPoints: 'houseJoinPoints', houseJoinPoints: 'houseJoinPoints',

View File

@@ -162,6 +162,8 @@ export const SitePreferencesScalarFieldEnum = {
eventsBackground: 'eventsBackground', eventsBackground: 'eventsBackground',
leaderboardBackground: 'leaderboardBackground', leaderboardBackground: 'leaderboardBackground',
challengesBackground: 'challengesBackground', challengesBackground: 'challengesBackground',
profileBackground: 'profileBackground',
houseBackground: 'houseBackground',
eventRegistrationPoints: 'eventRegistrationPoints', eventRegistrationPoints: 'eventRegistrationPoints',
eventFeedbackPoints: 'eventFeedbackPoints', eventFeedbackPoints: 'eventFeedbackPoints',
houseJoinPoints: 'houseJoinPoints', houseJoinPoints: 'houseJoinPoints',

View File

@@ -48,6 +48,8 @@ export type SitePreferencesMinAggregateOutputType = {
eventsBackground: string | null eventsBackground: string | null
leaderboardBackground: string | null leaderboardBackground: string | null
challengesBackground: string | null challengesBackground: string | null
profileBackground: string | null
houseBackground: string | null
eventRegistrationPoints: number | null eventRegistrationPoints: number | null
eventFeedbackPoints: number | null eventFeedbackPoints: number | null
houseJoinPoints: number | null houseJoinPoints: number | null
@@ -63,6 +65,8 @@ export type SitePreferencesMaxAggregateOutputType = {
eventsBackground: string | null eventsBackground: string | null
leaderboardBackground: string | null leaderboardBackground: string | null
challengesBackground: string | null challengesBackground: string | null
profileBackground: string | null
houseBackground: string | null
eventRegistrationPoints: number | null eventRegistrationPoints: number | null
eventFeedbackPoints: number | null eventFeedbackPoints: number | null
houseJoinPoints: number | null houseJoinPoints: number | null
@@ -78,6 +82,8 @@ export type SitePreferencesCountAggregateOutputType = {
eventsBackground: number eventsBackground: number
leaderboardBackground: number leaderboardBackground: number
challengesBackground: number challengesBackground: number
profileBackground: number
houseBackground: number
eventRegistrationPoints: number eventRegistrationPoints: number
eventFeedbackPoints: number eventFeedbackPoints: number
houseJoinPoints: number houseJoinPoints: number
@@ -111,6 +117,8 @@ export type SitePreferencesMinAggregateInputType = {
eventsBackground?: true eventsBackground?: true
leaderboardBackground?: true leaderboardBackground?: true
challengesBackground?: true challengesBackground?: true
profileBackground?: true
houseBackground?: true
eventRegistrationPoints?: true eventRegistrationPoints?: true
eventFeedbackPoints?: true eventFeedbackPoints?: true
houseJoinPoints?: true houseJoinPoints?: true
@@ -126,6 +134,8 @@ export type SitePreferencesMaxAggregateInputType = {
eventsBackground?: true eventsBackground?: true
leaderboardBackground?: true leaderboardBackground?: true
challengesBackground?: true challengesBackground?: true
profileBackground?: true
houseBackground?: true
eventRegistrationPoints?: true eventRegistrationPoints?: true
eventFeedbackPoints?: true eventFeedbackPoints?: true
houseJoinPoints?: true houseJoinPoints?: true
@@ -141,6 +151,8 @@ export type SitePreferencesCountAggregateInputType = {
eventsBackground?: true eventsBackground?: true
leaderboardBackground?: true leaderboardBackground?: true
challengesBackground?: true challengesBackground?: true
profileBackground?: true
houseBackground?: true
eventRegistrationPoints?: true eventRegistrationPoints?: true
eventFeedbackPoints?: true eventFeedbackPoints?: true
houseJoinPoints?: true houseJoinPoints?: true
@@ -243,6 +255,8 @@ export type SitePreferencesGroupByOutputType = {
eventsBackground: string | null eventsBackground: string | null
leaderboardBackground: string | null leaderboardBackground: string | null
challengesBackground: string | null challengesBackground: string | null
profileBackground: string | null
houseBackground: string | null
eventRegistrationPoints: number eventRegistrationPoints: number
eventFeedbackPoints: number eventFeedbackPoints: number
houseJoinPoints: number houseJoinPoints: number
@@ -281,6 +295,8 @@ export type SitePreferencesWhereInput = {
eventsBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null eventsBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
leaderboardBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null leaderboardBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
challengesBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null challengesBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
profileBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
houseBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
eventRegistrationPoints?: Prisma.IntFilter<"SitePreferences"> | number eventRegistrationPoints?: Prisma.IntFilter<"SitePreferences"> | number
eventFeedbackPoints?: Prisma.IntFilter<"SitePreferences"> | number eventFeedbackPoints?: Prisma.IntFilter<"SitePreferences"> | number
houseJoinPoints?: Prisma.IntFilter<"SitePreferences"> | number houseJoinPoints?: Prisma.IntFilter<"SitePreferences"> | number
@@ -296,6 +312,8 @@ export type SitePreferencesOrderByWithRelationInput = {
eventsBackground?: Prisma.SortOrderInput | Prisma.SortOrder eventsBackground?: Prisma.SortOrderInput | Prisma.SortOrder
leaderboardBackground?: Prisma.SortOrderInput | Prisma.SortOrder leaderboardBackground?: Prisma.SortOrderInput | Prisma.SortOrder
challengesBackground?: Prisma.SortOrderInput | Prisma.SortOrder challengesBackground?: Prisma.SortOrderInput | Prisma.SortOrder
profileBackground?: Prisma.SortOrderInput | Prisma.SortOrder
houseBackground?: Prisma.SortOrderInput | Prisma.SortOrder
eventRegistrationPoints?: Prisma.SortOrder eventRegistrationPoints?: Prisma.SortOrder
eventFeedbackPoints?: Prisma.SortOrder eventFeedbackPoints?: Prisma.SortOrder
houseJoinPoints?: Prisma.SortOrder houseJoinPoints?: Prisma.SortOrder
@@ -314,6 +332,8 @@ export type SitePreferencesWhereUniqueInput = Prisma.AtLeast<{
eventsBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null eventsBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
leaderboardBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null leaderboardBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
challengesBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null challengesBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
profileBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
houseBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null
eventRegistrationPoints?: Prisma.IntFilter<"SitePreferences"> | number eventRegistrationPoints?: Prisma.IntFilter<"SitePreferences"> | number
eventFeedbackPoints?: Prisma.IntFilter<"SitePreferences"> | number eventFeedbackPoints?: Prisma.IntFilter<"SitePreferences"> | number
houseJoinPoints?: Prisma.IntFilter<"SitePreferences"> | number houseJoinPoints?: Prisma.IntFilter<"SitePreferences"> | number
@@ -329,6 +349,8 @@ export type SitePreferencesOrderByWithAggregationInput = {
eventsBackground?: Prisma.SortOrderInput | Prisma.SortOrder eventsBackground?: Prisma.SortOrderInput | Prisma.SortOrder
leaderboardBackground?: Prisma.SortOrderInput | Prisma.SortOrder leaderboardBackground?: Prisma.SortOrderInput | Prisma.SortOrder
challengesBackground?: Prisma.SortOrderInput | Prisma.SortOrder challengesBackground?: Prisma.SortOrderInput | Prisma.SortOrder
profileBackground?: Prisma.SortOrderInput | Prisma.SortOrder
houseBackground?: Prisma.SortOrderInput | Prisma.SortOrder
eventRegistrationPoints?: Prisma.SortOrder eventRegistrationPoints?: Prisma.SortOrder
eventFeedbackPoints?: Prisma.SortOrder eventFeedbackPoints?: Prisma.SortOrder
houseJoinPoints?: Prisma.SortOrder houseJoinPoints?: Prisma.SortOrder
@@ -352,6 +374,8 @@ export type SitePreferencesScalarWhereWithAggregatesInput = {
eventsBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null eventsBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null
leaderboardBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null leaderboardBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null
challengesBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null challengesBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null
profileBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null
houseBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null
eventRegistrationPoints?: Prisma.IntWithAggregatesFilter<"SitePreferences"> | number eventRegistrationPoints?: Prisma.IntWithAggregatesFilter<"SitePreferences"> | number
eventFeedbackPoints?: Prisma.IntWithAggregatesFilter<"SitePreferences"> | number eventFeedbackPoints?: Prisma.IntWithAggregatesFilter<"SitePreferences"> | number
houseJoinPoints?: Prisma.IntWithAggregatesFilter<"SitePreferences"> | number houseJoinPoints?: Prisma.IntWithAggregatesFilter<"SitePreferences"> | number
@@ -367,6 +391,8 @@ export type SitePreferencesCreateInput = {
eventsBackground?: string | null eventsBackground?: string | null
leaderboardBackground?: string | null leaderboardBackground?: string | null
challengesBackground?: string | null challengesBackground?: string | null
profileBackground?: string | null
houseBackground?: string | null
eventRegistrationPoints?: number eventRegistrationPoints?: number
eventFeedbackPoints?: number eventFeedbackPoints?: number
houseJoinPoints?: number houseJoinPoints?: number
@@ -382,6 +408,8 @@ export type SitePreferencesUncheckedCreateInput = {
eventsBackground?: string | null eventsBackground?: string | null
leaderboardBackground?: string | null leaderboardBackground?: string | null
challengesBackground?: string | null challengesBackground?: string | null
profileBackground?: string | null
houseBackground?: string | null
eventRegistrationPoints?: number eventRegistrationPoints?: number
eventFeedbackPoints?: number eventFeedbackPoints?: number
houseJoinPoints?: number houseJoinPoints?: number
@@ -397,6 +425,8 @@ export type SitePreferencesUpdateInput = {
eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
profileBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
houseBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number
eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number
houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number
@@ -412,6 +442,8 @@ export type SitePreferencesUncheckedUpdateInput = {
eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
profileBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
houseBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number
eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number
houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number
@@ -427,6 +459,8 @@ export type SitePreferencesCreateManyInput = {
eventsBackground?: string | null eventsBackground?: string | null
leaderboardBackground?: string | null leaderboardBackground?: string | null
challengesBackground?: string | null challengesBackground?: string | null
profileBackground?: string | null
houseBackground?: string | null
eventRegistrationPoints?: number eventRegistrationPoints?: number
eventFeedbackPoints?: number eventFeedbackPoints?: number
houseJoinPoints?: number houseJoinPoints?: number
@@ -442,6 +476,8 @@ export type SitePreferencesUpdateManyMutationInput = {
eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
profileBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
houseBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number
eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number
houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number
@@ -457,6 +493,8 @@ export type SitePreferencesUncheckedUpdateManyInput = {
eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null challengesBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
profileBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
houseBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number eventRegistrationPoints?: Prisma.IntFieldUpdateOperationsInput | number
eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number eventFeedbackPoints?: Prisma.IntFieldUpdateOperationsInput | number
houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number houseJoinPoints?: Prisma.IntFieldUpdateOperationsInput | number
@@ -472,6 +510,8 @@ export type SitePreferencesCountOrderByAggregateInput = {
eventsBackground?: Prisma.SortOrder eventsBackground?: Prisma.SortOrder
leaderboardBackground?: Prisma.SortOrder leaderboardBackground?: Prisma.SortOrder
challengesBackground?: Prisma.SortOrder challengesBackground?: Prisma.SortOrder
profileBackground?: Prisma.SortOrder
houseBackground?: Prisma.SortOrder
eventRegistrationPoints?: Prisma.SortOrder eventRegistrationPoints?: Prisma.SortOrder
eventFeedbackPoints?: Prisma.SortOrder eventFeedbackPoints?: Prisma.SortOrder
houseJoinPoints?: Prisma.SortOrder houseJoinPoints?: Prisma.SortOrder
@@ -495,6 +535,8 @@ export type SitePreferencesMaxOrderByAggregateInput = {
eventsBackground?: Prisma.SortOrder eventsBackground?: Prisma.SortOrder
leaderboardBackground?: Prisma.SortOrder leaderboardBackground?: Prisma.SortOrder
challengesBackground?: Prisma.SortOrder challengesBackground?: Prisma.SortOrder
profileBackground?: Prisma.SortOrder
houseBackground?: Prisma.SortOrder
eventRegistrationPoints?: Prisma.SortOrder eventRegistrationPoints?: Prisma.SortOrder
eventFeedbackPoints?: Prisma.SortOrder eventFeedbackPoints?: Prisma.SortOrder
houseJoinPoints?: Prisma.SortOrder houseJoinPoints?: Prisma.SortOrder
@@ -510,6 +552,8 @@ export type SitePreferencesMinOrderByAggregateInput = {
eventsBackground?: Prisma.SortOrder eventsBackground?: Prisma.SortOrder
leaderboardBackground?: Prisma.SortOrder leaderboardBackground?: Prisma.SortOrder
challengesBackground?: Prisma.SortOrder challengesBackground?: Prisma.SortOrder
profileBackground?: Prisma.SortOrder
houseBackground?: Prisma.SortOrder
eventRegistrationPoints?: Prisma.SortOrder eventRegistrationPoints?: Prisma.SortOrder
eventFeedbackPoints?: Prisma.SortOrder eventFeedbackPoints?: Prisma.SortOrder
houseJoinPoints?: Prisma.SortOrder houseJoinPoints?: Prisma.SortOrder
@@ -535,6 +579,8 @@ export type SitePreferencesSelect<ExtArgs extends runtime.Types.Extensions.Inter
eventsBackground?: boolean eventsBackground?: boolean
leaderboardBackground?: boolean leaderboardBackground?: boolean
challengesBackground?: boolean challengesBackground?: boolean
profileBackground?: boolean
houseBackground?: boolean
eventRegistrationPoints?: boolean eventRegistrationPoints?: boolean
eventFeedbackPoints?: boolean eventFeedbackPoints?: boolean
houseJoinPoints?: boolean houseJoinPoints?: boolean
@@ -550,6 +596,8 @@ export type SitePreferencesSelectCreateManyAndReturn<ExtArgs extends runtime.Typ
eventsBackground?: boolean eventsBackground?: boolean
leaderboardBackground?: boolean leaderboardBackground?: boolean
challengesBackground?: boolean challengesBackground?: boolean
profileBackground?: boolean
houseBackground?: boolean
eventRegistrationPoints?: boolean eventRegistrationPoints?: boolean
eventFeedbackPoints?: boolean eventFeedbackPoints?: boolean
houseJoinPoints?: boolean houseJoinPoints?: boolean
@@ -565,6 +613,8 @@ export type SitePreferencesSelectUpdateManyAndReturn<ExtArgs extends runtime.Typ
eventsBackground?: boolean eventsBackground?: boolean
leaderboardBackground?: boolean leaderboardBackground?: boolean
challengesBackground?: boolean challengesBackground?: boolean
profileBackground?: boolean
houseBackground?: boolean
eventRegistrationPoints?: boolean eventRegistrationPoints?: boolean
eventFeedbackPoints?: boolean eventFeedbackPoints?: boolean
houseJoinPoints?: boolean houseJoinPoints?: boolean
@@ -580,6 +630,8 @@ export type SitePreferencesSelectScalar = {
eventsBackground?: boolean eventsBackground?: boolean
leaderboardBackground?: boolean leaderboardBackground?: boolean
challengesBackground?: boolean challengesBackground?: boolean
profileBackground?: boolean
houseBackground?: boolean
eventRegistrationPoints?: boolean eventRegistrationPoints?: boolean
eventFeedbackPoints?: boolean eventFeedbackPoints?: boolean
houseJoinPoints?: boolean houseJoinPoints?: boolean
@@ -589,7 +641,7 @@ export type SitePreferencesSelectScalar = {
updatedAt?: boolean updatedAt?: boolean
} }
export type SitePreferencesOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "homeBackground" | "eventsBackground" | "leaderboardBackground" | "challengesBackground" | "eventRegistrationPoints" | "eventFeedbackPoints" | "houseJoinPoints" | "houseLeavePoints" | "houseCreatePoints" | "createdAt" | "updatedAt", ExtArgs["result"]["sitePreferences"]> export type SitePreferencesOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "homeBackground" | "eventsBackground" | "leaderboardBackground" | "challengesBackground" | "profileBackground" | "houseBackground" | "eventRegistrationPoints" | "eventFeedbackPoints" | "houseJoinPoints" | "houseLeavePoints" | "houseCreatePoints" | "createdAt" | "updatedAt", ExtArgs["result"]["sitePreferences"]>
export type $SitePreferencesPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = { export type $SitePreferencesPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "SitePreferences" name: "SitePreferences"
@@ -600,6 +652,8 @@ export type $SitePreferencesPayload<ExtArgs extends runtime.Types.Extensions.Int
eventsBackground: string | null eventsBackground: string | null
leaderboardBackground: string | null leaderboardBackground: string | null
challengesBackground: string | null challengesBackground: string | null
profileBackground: string | null
houseBackground: string | null
eventRegistrationPoints: number eventRegistrationPoints: number
eventFeedbackPoints: number eventFeedbackPoints: number
houseJoinPoints: number houseJoinPoints: number
@@ -1035,6 +1089,8 @@ export interface SitePreferencesFieldRefs {
readonly eventsBackground: Prisma.FieldRef<"SitePreferences", 'String'> readonly eventsBackground: Prisma.FieldRef<"SitePreferences", 'String'>
readonly leaderboardBackground: Prisma.FieldRef<"SitePreferences", 'String'> readonly leaderboardBackground: Prisma.FieldRef<"SitePreferences", 'String'>
readonly challengesBackground: Prisma.FieldRef<"SitePreferences", 'String'> readonly challengesBackground: Prisma.FieldRef<"SitePreferences", 'String'>
readonly profileBackground: Prisma.FieldRef<"SitePreferences", 'String'>
readonly houseBackground: Prisma.FieldRef<"SitePreferences", 'String'>
readonly eventRegistrationPoints: Prisma.FieldRef<"SitePreferences", 'Int'> readonly eventRegistrationPoints: Prisma.FieldRef<"SitePreferences", 'Int'>
readonly eventFeedbackPoints: Prisma.FieldRef<"SitePreferences", 'Int'> readonly eventFeedbackPoints: Prisma.FieldRef<"SitePreferences", 'Int'>
readonly houseJoinPoints: Prisma.FieldRef<"SitePreferences", 'Int'> readonly houseJoinPoints: Prisma.FieldRef<"SitePreferences", 'Int'>

View File

@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "SitePreferences" ADD COLUMN "profileBackground" TEXT;

View File

@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "SitePreferences" ADD COLUMN "houseBackground" TEXT;

View File

@@ -107,6 +107,8 @@ model SitePreferences {
eventsBackground String? eventsBackground String?
leaderboardBackground String? leaderboardBackground String?
challengesBackground String? challengesBackground String?
profileBackground String?
houseBackground String?
eventRegistrationPoints Int @default(100) eventRegistrationPoints Int @default(100)
eventFeedbackPoints Int @default(100) eventFeedbackPoints Int @default(100)
houseJoinPoints Int @default(100) houseJoinPoints Int @default(100)

View File

@@ -14,6 +14,8 @@ export interface UpdateSitePreferencesInput {
eventsBackground?: string | null; eventsBackground?: string | null;
leaderboardBackground?: string | null; leaderboardBackground?: string | null;
challengesBackground?: string | null; challengesBackground?: string | null;
profileBackground?: string | null;
houseBackground?: string | null;
eventRegistrationPoints?: number; eventRegistrationPoints?: number;
eventFeedbackPoints?: number; eventFeedbackPoints?: number;
houseJoinPoints?: number; houseJoinPoints?: number;
@@ -50,6 +52,8 @@ export class SitePreferencesService {
eventsBackground: null, eventsBackground: null,
leaderboardBackground: null, leaderboardBackground: null,
challengesBackground: null, challengesBackground: null,
profileBackground: null,
houseBackground: null,
eventRegistrationPoints: 100, eventRegistrationPoints: 100,
eventFeedbackPoints: 100, eventFeedbackPoints: 100,
houseJoinPoints: 100, houseJoinPoints: 100,
@@ -93,6 +97,14 @@ export class SitePreferencesService {
data.challengesBackground === "" data.challengesBackground === ""
? null ? null
: (data.challengesBackground ?? undefined), : (data.challengesBackground ?? undefined),
profileBackground:
data.profileBackground === ""
? null
: (data.profileBackground ?? undefined),
houseBackground:
data.houseBackground === ""
? null
: (data.houseBackground ?? undefined),
eventRegistrationPoints: eventRegistrationPoints:
data.eventRegistrationPoints !== undefined data.eventRegistrationPoints !== undefined
? data.eventRegistrationPoints ? data.eventRegistrationPoints
@@ -126,6 +138,12 @@ export class SitePreferencesService {
data.challengesBackground === "" data.challengesBackground === ""
? null ? null
: (data.challengesBackground ?? null), : (data.challengesBackground ?? null),
profileBackground:
data.profileBackground === ""
? null
: (data.profileBackground ?? null),
houseBackground:
data.houseBackground === "" ? null : (data.houseBackground ?? null),
eventRegistrationPoints: data.eventRegistrationPoints ?? 100, eventRegistrationPoints: data.eventRegistrationPoints ?? 100,
eventFeedbackPoints: data.eventFeedbackPoints ?? 100, eventFeedbackPoints: data.eventFeedbackPoints ?? 100,
houseJoinPoints: data.houseJoinPoints ?? 100, houseJoinPoints: data.houseJoinPoints ?? 100,
@@ -139,7 +157,13 @@ export class SitePreferencesService {
* Récupère l'image de fond pour une page donnée * Récupère l'image de fond pour une page donnée
*/ */
async getBackgroundImage( async getBackgroundImage(
page: "home" | "events" | "leaderboard" | "challenges", page:
| "home"
| "events"
| "leaderboard"
| "challenges"
| "profile"
| "houses",
defaultImage: string defaultImage: string
): Promise<string> { ): Promise<string> {
try { try {
@@ -151,7 +175,9 @@ export class SitePreferencesService {
return defaultImage; return defaultImage;
} }
const imageKey = `${page}Background` as keyof typeof sitePreferences; // Mapping spécial pour "houses" -> "house" (car la colonne est houseBackground)
const dbPage = page === "houses" ? "house" : page;
const imageKey = `${dbPage}Background` as keyof typeof sitePreferences;
const customImage = sitePreferences[imageKey]; const customImage = sitePreferences[imageKey];
const imageUrl = (customImage as string | null) || defaultImage; const imageUrl = (customImage as string | null) || defaultImage;