Implement house points system: Add houseJoinPoints, houseLeavePoints, and houseCreatePoints to SitePreferences model and update related services. Enhance house management features to award and deduct points for house creation, membership removal, and leaving a house. Update environment configuration for PostgreSQL and adjust UI components to reflect new functionalities.
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled
This commit is contained in:
@@ -8,6 +8,7 @@ import type {
|
||||
InvitationStatus,
|
||||
RequestStatus,
|
||||
Prisma,
|
||||
SitePreferences,
|
||||
} from "@/prisma/generated/prisma/client";
|
||||
import {
|
||||
ValidationError,
|
||||
@@ -15,6 +16,14 @@ import {
|
||||
ConflictError,
|
||||
ForbiddenError,
|
||||
} from "../errors";
|
||||
import { sitePreferencesService } from "../preferences/site-preferences.service";
|
||||
|
||||
// Type étendu pour les préférences avec les nouveaux champs de points des maisons
|
||||
type SitePreferencesWithHousePoints = SitePreferences & {
|
||||
houseJoinPoints?: number;
|
||||
houseLeavePoints?: number;
|
||||
houseCreatePoints?: number;
|
||||
};
|
||||
|
||||
const HOUSE_NAME_MIN_LENGTH = 3;
|
||||
const HOUSE_NAME_MAX_LENGTH = 50;
|
||||
@@ -143,10 +152,7 @@ export class HouseService {
|
||||
/**
|
||||
* Vérifie si un utilisateur est membre d'une maison
|
||||
*/
|
||||
async isUserMemberOfHouse(
|
||||
userId: string,
|
||||
houseId: string
|
||||
): Promise<boolean> {
|
||||
async isUserMemberOfHouse(userId: string, houseId: string): Promise<boolean> {
|
||||
const membership = await prisma.houseMembership.findUnique({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
@@ -161,10 +167,7 @@ export class HouseService {
|
||||
/**
|
||||
* Vérifie si un utilisateur est propriétaire ou admin d'une maison
|
||||
*/
|
||||
async isUserOwnerOrAdmin(
|
||||
userId: string,
|
||||
houseId: string
|
||||
): Promise<boolean> {
|
||||
async isUserOwnerOrAdmin(userId: string, houseId: string): Promise<boolean> {
|
||||
const membership = await prisma.houseMembership.findUnique({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
@@ -248,7 +251,10 @@ export class HouseService {
|
||||
);
|
||||
}
|
||||
|
||||
if (data.description && data.description.length > HOUSE_DESCRIPTION_MAX_LENGTH) {
|
||||
if (
|
||||
data.description &&
|
||||
data.description.length > HOUSE_DESCRIPTION_MAX_LENGTH
|
||||
) {
|
||||
throw new ValidationError(
|
||||
`La description ne peut pas dépasser ${HOUSE_DESCRIPTION_MAX_LENGTH} caractères`,
|
||||
"description"
|
||||
@@ -280,19 +286,46 @@ export class HouseService {
|
||||
throw new ConflictError("Ce nom de maison est déjà utilisé");
|
||||
}
|
||||
|
||||
// Créer la maison et ajouter le créateur comme OWNER
|
||||
return prisma.house.create({
|
||||
data: {
|
||||
name: data.name.trim(),
|
||||
description: data.description?.trim() || null,
|
||||
creatorId: data.creatorId,
|
||||
memberships: {
|
||||
create: {
|
||||
userId: data.creatorId,
|
||||
role: "OWNER",
|
||||
// Récupérer les points à attribuer depuis les préférences du site
|
||||
const sitePreferences =
|
||||
await sitePreferencesService.getOrCreateSitePreferences();
|
||||
const pointsToAward =
|
||||
(sitePreferences as SitePreferencesWithHousePoints).houseCreatePoints ??
|
||||
100;
|
||||
console.log(
|
||||
"[HouseService] Creating house - points to award:",
|
||||
pointsToAward,
|
||||
"preferences:",
|
||||
sitePreferences
|
||||
);
|
||||
|
||||
// Créer la maison et ajouter le créateur comme OWNER, puis attribuer les points
|
||||
return prisma.$transaction(async (tx) => {
|
||||
const house = await tx.house.create({
|
||||
data: {
|
||||
name: data.name.trim(),
|
||||
description: data.description?.trim() || null,
|
||||
creatorId: data.creatorId,
|
||||
memberships: {
|
||||
create: {
|
||||
userId: data.creatorId,
|
||||
role: "OWNER",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Attribuer les points au créateur
|
||||
await tx.user.update({
|
||||
where: { id: data.creatorId },
|
||||
data: {
|
||||
score: {
|
||||
increment: pointsToAward,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return house;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -348,7 +381,10 @@ export class HouseService {
|
||||
}
|
||||
|
||||
if (data.description !== undefined) {
|
||||
if (data.description && data.description.length > HOUSE_DESCRIPTION_MAX_LENGTH) {
|
||||
if (
|
||||
data.description &&
|
||||
data.description.length > HOUSE_DESCRIPTION_MAX_LENGTH
|
||||
) {
|
||||
throw new ValidationError(
|
||||
`La description ne peut pas dépasser ${HOUSE_DESCRIPTION_MAX_LENGTH} caractères`,
|
||||
"description"
|
||||
@@ -370,13 +406,48 @@ export class HouseService {
|
||||
// Vérifier que l'utilisateur est propriétaire
|
||||
const isOwner = await this.isUserOwner(userId, houseId);
|
||||
if (!isOwner) {
|
||||
throw new ForbiddenError(
|
||||
"Seul le propriétaire peut supprimer la maison"
|
||||
);
|
||||
throw new ForbiddenError("Seul le propriétaire peut supprimer la maison");
|
||||
}
|
||||
|
||||
await prisma.house.delete({
|
||||
// Récupérer la maison pour obtenir le créateur
|
||||
const house = await prisma.house.findUnique({
|
||||
where: { id: houseId },
|
||||
select: { creatorId: true },
|
||||
});
|
||||
|
||||
if (!house) {
|
||||
throw new NotFoundError("Maison");
|
||||
}
|
||||
|
||||
// Récupérer les points à enlever depuis les préférences du site
|
||||
const sitePreferences =
|
||||
await sitePreferencesService.getOrCreateSitePreferences();
|
||||
const pointsToDeduct =
|
||||
(sitePreferences as SitePreferencesWithHousePoints).houseCreatePoints ??
|
||||
100;
|
||||
console.log(
|
||||
"[HouseService] Deleting house - points to deduct:",
|
||||
pointsToDeduct,
|
||||
"creatorId:",
|
||||
house.creatorId
|
||||
);
|
||||
|
||||
// Supprimer la maison et enlever les points au créateur
|
||||
await prisma.$transaction(async (tx) => {
|
||||
// Enlever les points au créateur
|
||||
await tx.user.update({
|
||||
where: { id: house.creatorId },
|
||||
data: {
|
||||
score: {
|
||||
decrement: pointsToDeduct,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Supprimer la maison (cela supprimera automatiquement les membreships, invitations, etc. grâce aux CASCADE)
|
||||
await tx.house.delete({
|
||||
where: { id: houseId },
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -404,22 +475,6 @@ export class HouseService {
|
||||
throw new ConflictError("Cet utilisateur est déjà membre de la maison");
|
||||
}
|
||||
|
||||
// Vérifier qu'il n'y a pas déjà une invitation en attente
|
||||
const existingInvitation = await prisma.houseInvitation.findUnique({
|
||||
where: {
|
||||
houseId_inviteeId: {
|
||||
houseId: data.houseId,
|
||||
inviteeId: data.inviteeId,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (existingInvitation && existingInvitation.status === "PENDING") {
|
||||
throw new ConflictError(
|
||||
"Une invitation est déjà en attente pour cet utilisateur"
|
||||
);
|
||||
}
|
||||
|
||||
// Vérifier que l'invité n'est pas déjà dans une autre maison
|
||||
const existingMembership = await prisma.houseMembership.findFirst({
|
||||
where: { userId: data.inviteeId },
|
||||
@@ -431,6 +486,37 @@ export class HouseService {
|
||||
);
|
||||
}
|
||||
|
||||
// Vérifier s'il existe déjà une invitation (peu importe le statut)
|
||||
const existingInvitation = await prisma.houseInvitation.findUnique({
|
||||
where: {
|
||||
houseId_inviteeId: {
|
||||
houseId: data.houseId,
|
||||
inviteeId: data.inviteeId,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (existingInvitation) {
|
||||
if (existingInvitation.status === "PENDING") {
|
||||
throw new ConflictError(
|
||||
"Une invitation est déjà en attente pour cet utilisateur"
|
||||
);
|
||||
}
|
||||
// Si l'invitation existe avec un autre statut, on la réinitialise
|
||||
return prisma.houseInvitation.update({
|
||||
where: {
|
||||
houseId_inviteeId: {
|
||||
houseId: data.houseId,
|
||||
inviteeId: data.inviteeId,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
inviterId: data.inviterId,
|
||||
status: "PENDING",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Créer l'invitation
|
||||
return prisma.houseInvitation.create({
|
||||
data: {
|
||||
@@ -476,6 +562,19 @@ export class HouseService {
|
||||
);
|
||||
}
|
||||
|
||||
// Récupérer les points à attribuer depuis les préférences du site
|
||||
const sitePreferences =
|
||||
await sitePreferencesService.getOrCreateSitePreferences();
|
||||
const pointsToAward =
|
||||
(sitePreferences as SitePreferencesWithHousePoints).houseJoinPoints ??
|
||||
100;
|
||||
console.log(
|
||||
"[HouseService] Accepting invitation - points to award:",
|
||||
pointsToAward,
|
||||
"userId:",
|
||||
userId
|
||||
);
|
||||
|
||||
// Créer le membership et mettre à jour l'invitation
|
||||
return prisma.$transaction(async (tx) => {
|
||||
const membership = await tx.houseMembership.create({
|
||||
@@ -510,6 +609,16 @@ export class HouseService {
|
||||
data: { status: "CANCELLED" },
|
||||
});
|
||||
|
||||
// Attribuer les points à l'utilisateur qui rejoint
|
||||
await tx.user.update({
|
||||
where: { id: userId },
|
||||
data: {
|
||||
score: {
|
||||
increment: pointsToAward,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return membership;
|
||||
});
|
||||
}
|
||||
@@ -592,7 +701,7 @@ export class HouseService {
|
||||
);
|
||||
}
|
||||
|
||||
// Vérifier qu'il n'y a pas déjà une demande en attente
|
||||
// Vérifier s'il existe déjà une demande
|
||||
const existingRequest = await prisma.houseRequest.findUnique({
|
||||
where: {
|
||||
houseId_requesterId: {
|
||||
@@ -602,13 +711,27 @@ export class HouseService {
|
||||
},
|
||||
});
|
||||
|
||||
if (existingRequest && existingRequest.status === "PENDING") {
|
||||
throw new ConflictError(
|
||||
"Une demande est déjà en attente pour cette maison"
|
||||
);
|
||||
if (existingRequest) {
|
||||
if (existingRequest.status === "PENDING") {
|
||||
throw new ConflictError(
|
||||
"Une demande est déjà en attente pour cette maison"
|
||||
);
|
||||
}
|
||||
// Si la demande existe mais n'est pas PENDING (REJECTED, CANCELLED), on la réactive
|
||||
return prisma.houseRequest.update({
|
||||
where: {
|
||||
houseId_requesterId: {
|
||||
houseId: data.houseId,
|
||||
requesterId: data.requesterId,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
status: "PENDING",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Créer la demande
|
||||
// Créer une nouvelle demande
|
||||
return prisma.houseRequest.create({
|
||||
data: {
|
||||
houseId: data.houseId,
|
||||
@@ -635,10 +758,7 @@ export class HouseService {
|
||||
}
|
||||
|
||||
// Vérifier que l'utilisateur est propriétaire ou admin de la maison
|
||||
const isAuthorized = await this.isUserOwnerOrAdmin(
|
||||
userId,
|
||||
request.houseId
|
||||
);
|
||||
const isAuthorized = await this.isUserOwnerOrAdmin(userId, request.houseId);
|
||||
if (!isAuthorized) {
|
||||
throw new ForbiddenError(
|
||||
"Vous n'avez pas les permissions pour accepter cette demande"
|
||||
@@ -660,6 +780,19 @@ export class HouseService {
|
||||
);
|
||||
}
|
||||
|
||||
// Récupérer les points à attribuer depuis les préférences du site
|
||||
const sitePreferences =
|
||||
await sitePreferencesService.getOrCreateSitePreferences();
|
||||
const pointsToAward =
|
||||
(sitePreferences as SitePreferencesWithHousePoints).houseJoinPoints ??
|
||||
100;
|
||||
console.log(
|
||||
"[HouseService] Accepting request - points to award:",
|
||||
pointsToAward,
|
||||
"requesterId:",
|
||||
request.requesterId
|
||||
);
|
||||
|
||||
// Créer le membership et mettre à jour la demande
|
||||
return prisma.$transaction(async (tx) => {
|
||||
const membership = await tx.houseMembership.create({
|
||||
@@ -694,6 +827,16 @@ export class HouseService {
|
||||
data: { status: "CANCELLED" },
|
||||
});
|
||||
|
||||
// Attribuer les points à l'utilisateur qui rejoint
|
||||
await tx.user.update({
|
||||
where: { id: request.requesterId },
|
||||
data: {
|
||||
score: {
|
||||
increment: pointsToAward,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return membership;
|
||||
});
|
||||
}
|
||||
@@ -711,10 +854,7 @@ export class HouseService {
|
||||
}
|
||||
|
||||
// Vérifier que l'utilisateur est propriétaire ou admin de la maison
|
||||
const isAuthorized = await this.isUserOwnerOrAdmin(
|
||||
userId,
|
||||
request.houseId
|
||||
);
|
||||
const isAuthorized = await this.isUserOwnerOrAdmin(userId, request.houseId);
|
||||
if (!isAuthorized) {
|
||||
throw new ForbiddenError(
|
||||
"Vous n'avez pas les permissions pour refuser cette demande"
|
||||
@@ -759,6 +899,88 @@ export class HouseService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retire un membre d'une maison (par un OWNER ou ADMIN)
|
||||
*/
|
||||
async removeMember(
|
||||
houseId: string,
|
||||
memberIdToRemove: string,
|
||||
removerId: string
|
||||
): Promise<void> {
|
||||
// Vérifier que celui qui retire est OWNER ou ADMIN
|
||||
const isAuthorized = await this.isUserOwnerOrAdmin(removerId, houseId);
|
||||
if (!isAuthorized) {
|
||||
throw new ForbiddenError(
|
||||
"Vous n'avez pas les permissions pour retirer un membre"
|
||||
);
|
||||
}
|
||||
|
||||
// Récupérer les membreships
|
||||
const removerMembership = await prisma.houseMembership.findUnique({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
houseId,
|
||||
userId: removerId,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const memberToRemoveMembership = await prisma.houseMembership.findUnique({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
houseId,
|
||||
userId: memberIdToRemove,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!memberToRemoveMembership) {
|
||||
throw new NotFoundError("Membre");
|
||||
}
|
||||
|
||||
// Un OWNER ne peut pas être retiré
|
||||
if (memberToRemoveMembership.role === "OWNER") {
|
||||
throw new ForbiddenError("Le propriétaire ne peut pas être retiré");
|
||||
}
|
||||
|
||||
// Un ADMIN ne peut retirer que des MEMBER (pas d'autres ADMIN)
|
||||
if (
|
||||
removerMembership?.role === "ADMIN" &&
|
||||
memberToRemoveMembership.role === "ADMIN"
|
||||
) {
|
||||
throw new ForbiddenError("Un admin ne peut pas retirer un autre admin");
|
||||
}
|
||||
|
||||
// Récupérer les points à enlever depuis les préférences du site
|
||||
const sitePreferences =
|
||||
await sitePreferencesService.getOrCreateSitePreferences();
|
||||
const pointsToDeduct =
|
||||
(sitePreferences as SitePreferencesWithHousePoints).houseLeavePoints ??
|
||||
100;
|
||||
|
||||
// Supprimer le membership et enlever les points
|
||||
await prisma.$transaction(async (tx) => {
|
||||
await tx.houseMembership.delete({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
houseId,
|
||||
userId: memberIdToRemove,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Enlever les points à l'utilisateur retiré
|
||||
await tx.user.update({
|
||||
where: { id: memberIdToRemove },
|
||||
data: {
|
||||
score: {
|
||||
decrement: pointsToDeduct,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Quitte une maison
|
||||
*/
|
||||
@@ -783,13 +1005,39 @@ export class HouseService {
|
||||
);
|
||||
}
|
||||
|
||||
await prisma.houseMembership.delete({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
houseId,
|
||||
userId,
|
||||
// Récupérer les points à enlever depuis les préférences du site
|
||||
const sitePreferences =
|
||||
await sitePreferencesService.getOrCreateSitePreferences();
|
||||
const pointsToDeduct =
|
||||
(sitePreferences as SitePreferencesWithHousePoints).houseLeavePoints ??
|
||||
100;
|
||||
console.log(
|
||||
"[HouseService] Leaving house - points to deduct:",
|
||||
pointsToDeduct,
|
||||
"userId:",
|
||||
userId
|
||||
);
|
||||
|
||||
// Supprimer le membership et enlever les points
|
||||
await prisma.$transaction(async (tx) => {
|
||||
await tx.houseMembership.delete({
|
||||
where: {
|
||||
houseId_userId: {
|
||||
houseId,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Enlever les points à l'utilisateur qui quitte
|
||||
await tx.user.update({
|
||||
where: { id: userId },
|
||||
data: {
|
||||
score: {
|
||||
decrement: pointsToDeduct,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -819,6 +1067,66 @@ export class HouseService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compte les invitations en attente pour un utilisateur
|
||||
*/
|
||||
async getPendingInvitationsCount(userId: string): Promise<number> {
|
||||
return prisma.houseInvitation.count({
|
||||
where: {
|
||||
inviteeId: userId,
|
||||
status: "PENDING",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compte les demandes d'adhésion en attente pour un utilisateur
|
||||
* (demandes reçues pour les maisons dont l'utilisateur est propriétaire ou admin)
|
||||
*/
|
||||
async getPendingRequestsCount(userId: string): Promise<number> {
|
||||
// Trouver toutes les maisons où l'utilisateur est OWNER ou ADMIN
|
||||
const userHouses = await prisma.houseMembership.findMany({
|
||||
where: {
|
||||
userId,
|
||||
role: {
|
||||
in: ["OWNER", "ADMIN"],
|
||||
},
|
||||
},
|
||||
select: {
|
||||
houseId: true,
|
||||
},
|
||||
});
|
||||
|
||||
const houseIds = userHouses.map((m) => m.houseId);
|
||||
|
||||
if (houseIds.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Compter les demandes PENDING pour ces maisons
|
||||
return prisma.houseRequest.count({
|
||||
where: {
|
||||
houseId: {
|
||||
in: houseIds,
|
||||
},
|
||||
status: "PENDING",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compte le total des invitations et demandes en attente pour un utilisateur
|
||||
* - Invitations : invitations reçues par l'utilisateur (inviteeId)
|
||||
* - Demandes : demandes reçues pour les maisons dont l'utilisateur est OWNER ou ADMIN
|
||||
*/
|
||||
async getPendingHouseActionsCount(userId: string): Promise<number> {
|
||||
const [invitationsCount, requestsCount] = await Promise.all([
|
||||
this.getPendingInvitationsCount(userId),
|
||||
this.getPendingRequestsCount(userId),
|
||||
]);
|
||||
return invitationsCount + requestsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les demandes d'une maison
|
||||
*/
|
||||
@@ -879,9 +1187,7 @@ export class HouseService {
|
||||
/**
|
||||
* Récupère une invitation par son ID (avec seulement houseId)
|
||||
*/
|
||||
async getInvitationById(
|
||||
id: string
|
||||
): Promise<{ houseId: string } | null> {
|
||||
async getInvitationById(id: string): Promise<{ houseId: string } | null> {
|
||||
return prisma.houseInvitation.findUnique({
|
||||
where: { id },
|
||||
select: { houseId: true },
|
||||
@@ -890,4 +1196,3 @@ export class HouseService {
|
||||
}
|
||||
|
||||
export const houseService = new HouseService();
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@ import { prisma } from "../database";
|
||||
import { normalizeBackgroundUrl } from "@/lib/avatars";
|
||||
import type { SitePreferences } from "@/prisma/generated/prisma/client";
|
||||
|
||||
// Type étendu pour les préférences avec les nouveaux champs de points des maisons
|
||||
type SitePreferencesWithHousePoints = SitePreferences & {
|
||||
houseJoinPoints?: number;
|
||||
houseLeavePoints?: number;
|
||||
houseCreatePoints?: number;
|
||||
};
|
||||
|
||||
export interface UpdateSitePreferencesInput {
|
||||
homeBackground?: string | null;
|
||||
eventsBackground?: string | null;
|
||||
@@ -9,6 +16,9 @@ export interface UpdateSitePreferencesInput {
|
||||
challengesBackground?: string | null;
|
||||
eventRegistrationPoints?: number;
|
||||
eventFeedbackPoints?: number;
|
||||
houseJoinPoints?: number;
|
||||
houseLeavePoints?: number;
|
||||
houseCreatePoints?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,10 +52,19 @@ export class SitePreferencesService {
|
||||
challengesBackground: null,
|
||||
eventRegistrationPoints: 100,
|
||||
eventFeedbackPoints: 100,
|
||||
houseJoinPoints: 100,
|
||||
houseLeavePoints: 100,
|
||||
houseCreatePoints: 100,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// S'assurer que les valeurs par défaut sont présentes même si les colonnes n'existent pas encore
|
||||
const prefs = sitePreferences as SitePreferencesWithHousePoints;
|
||||
if (prefs.houseJoinPoints == null) prefs.houseJoinPoints = 100;
|
||||
if (prefs.houseLeavePoints == null) prefs.houseLeavePoints = 100;
|
||||
if (prefs.houseCreatePoints == null) prefs.houseCreatePoints = 100;
|
||||
|
||||
return sitePreferences;
|
||||
}
|
||||
|
||||
@@ -82,6 +101,16 @@ export class SitePreferencesService {
|
||||
data.eventFeedbackPoints !== undefined
|
||||
? data.eventFeedbackPoints
|
||||
: undefined,
|
||||
houseJoinPoints:
|
||||
data.houseJoinPoints !== undefined ? data.houseJoinPoints : undefined,
|
||||
houseLeavePoints:
|
||||
data.houseLeavePoints !== undefined
|
||||
? data.houseLeavePoints
|
||||
: undefined,
|
||||
houseCreatePoints:
|
||||
data.houseCreatePoints !== undefined
|
||||
? data.houseCreatePoints
|
||||
: undefined,
|
||||
},
|
||||
create: {
|
||||
id: "global",
|
||||
@@ -99,6 +128,9 @@ export class SitePreferencesService {
|
||||
: (data.challengesBackground ?? null),
|
||||
eventRegistrationPoints: data.eventRegistrationPoints ?? 100,
|
||||
eventFeedbackPoints: data.eventFeedbackPoints ?? 100,
|
||||
houseJoinPoints: data.houseJoinPoints ?? 100,
|
||||
houseLeavePoints: data.houseLeavePoints ?? 100,
|
||||
houseCreatePoints: data.houseCreatePoints ?? 100,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user