fix: restore complete admin feature dependencies

This commit is contained in:
Simo committed 2026-07-11 21:15:54 +02:00
1 parent 5b4228261a
commit 0cd753c735
115 files changed
+18565 -4930

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { unstable_cache } from 'next/cache'
import { prisma } from '@/lib/prisma'
/**
* Returns the set of user IDs that the given staff member has marked as
* "watch". Cached 60s + tag-invalidated by toggleUserWatch.
*/
export async function getWatchedUserIds(staffId: number): Promise<Set<number>> {
const ids = await getCachedWatchedIds(staffId)
return new Set(ids)
}
const getCachedWatchedIds = unstable_cache(
async (staffId: number): Promise<number[]> => {
const rows = await prisma.userWatch.findMany({
where: { staffId },
select: { targetUserId: true },
})
return rows.map((r) => r.targetUserId)
},
['user-watch-list'],
{ revalidate: 60, tags: ['user-watch'] },
)