This commit is contained in:
1 parent
8efd032cc6
commit
df38dccbf1
735 files changed
+128321
-120870
No files matched your search
+11
-11
@@ -6,18 +6,18 @@ import { prisma } from "@/lib/prisma";
|
||||
* "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 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"] },
|
||||
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"] },
|
||||
);
|
||||
Reference in new issue
Block a user