Fix UserStats typing in users page counters
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m58s

This commit is contained in:
2026-03-04 17:04:09 +01:00
parent 367eea6ee8
commit f2c1b195b3

View File

@@ -1,6 +1,6 @@
import { auth } from '@/lib/auth';
import { redirect } from 'next/navigation';
import { getAllUsersWithStats } from '@/services/auth';
import { getAllUsersWithStats, type UserStats } from '@/services/auth';
import { getGravatarUrl } from '@/lib/gravatar';
import { PageHeader } from '@/components/ui';
@@ -11,7 +11,7 @@ const OWNED_WORKSHOP_COUNT_KEYS = [
'weeklyCheckInSessions',
'weatherSessions',
'gifMoodSessions',
] as const;
] as const satisfies readonly (keyof UserStats)[];
const SHARED_WORKSHOP_COUNT_KEYS = [
'sharedSessions',
@@ -20,12 +20,9 @@ const SHARED_WORKSHOP_COUNT_KEYS = [
'sharedWeeklyCheckInSessions',
'sharedWeatherSessions',
'sharedGifMoodSessions',
] as const;
] as const satisfies readonly (keyof UserStats)[];
function sumCountKeys(
counts: Record<string, number>,
keys: readonly string[]
): number {
function sumCountKeys(counts: UserStats, keys: readonly (keyof UserStats)[]): number {
return keys.reduce((acc, key) => acc + (counts[key] ?? 0), 0);
}