refactor: improve team management, OKRs, and session components
This commit is contained in:
@@ -69,8 +69,7 @@ export async function getWeatherSessionById(sessionId: string, userId: string) {
|
||||
where: { id: sid, OR: [{ userId: uid }, { shares: { some: { userId: uid } } }] },
|
||||
include: weatherByIdInclude,
|
||||
}),
|
||||
(sid) =>
|
||||
prisma.weatherSession.findUnique({ where: { id: sid }, include: weatherByIdInclude })
|
||||
(sid) => prisma.weatherSession.findUnique({ where: { id: sid }, include: weatherByIdInclude })
|
||||
);
|
||||
}
|
||||
|
||||
@@ -177,7 +176,6 @@ export async function deleteWeatherEntry(sessionId: string, userId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Returns the most recent WeatherEntry per userId from any session BEFORE sessionDate,
|
||||
// excluding the current session. Returned as a map userId → entry.
|
||||
export async function getPreviousWeatherEntriesForUsers(
|
||||
@@ -240,7 +238,8 @@ export async function getPreviousWeatherEntriesForUsers(
|
||||
valueCreationEmoji: null as string | null,
|
||||
};
|
||||
if (!existing) map.set(entry.userId, base);
|
||||
if (base.performanceEmoji == null && entry.performanceEmoji != null) base.performanceEmoji = entry.performanceEmoji;
|
||||
if (base.performanceEmoji == null && entry.performanceEmoji != null)
|
||||
base.performanceEmoji = entry.performanceEmoji;
|
||||
if (base.moralEmoji == null && entry.moralEmoji != null) base.moralEmoji = entry.moralEmoji;
|
||||
if (base.fluxEmoji == null && entry.fluxEmoji != null) base.fluxEmoji = entry.fluxEmoji;
|
||||
if (base.valueCreationEmoji == null && entry.valueCreationEmoji != null)
|
||||
@@ -287,7 +286,7 @@ export async function shareWeatherSessionToTeam(
|
||||
},
|
||||
});
|
||||
if (existingCount > 0) {
|
||||
throw new Error("Cette équipe a déjà une météo pour cette semaine");
|
||||
throw new Error('Cette équipe a déjà une météo pour cette semaine');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user