Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
refactor: remove digest option (for now)
Marc Seitz76cabe526834
diff --git a/app/api/cron/notification-digest/daily/route.ts b/app/api/cron/notification-digest/daily/route.tsdeleted file mode 100644index 22094bad..00000000--- a/app/api/cron/notification-digest/daily/route.ts+++ /dev/null@@ -1,32 +0,0 @@-import { NextResponse } from "next/server";--import { receiver } from "@/lib/cron";-import { processNotificationDigest } from "@/lib/notifications/process-digest";-import { log } from "@/lib/utils";--export const maxDuration = 300;--export async function POST(req: Request) {- const body = await req.json();- if (process.env.VERCEL === "1") {- const isValid = await receiver.verify({- signature: req.headers.get("Upstash-Signature") || "",- body: JSON.stringify(body),- });- if (!isValid) {- return new Response("Unauthorized", { status: 401 });- }- }-- try {- const result = await processNotificationDigest("DAILY");- return NextResponse.json({ success: true, ...result });- } catch (error) {- await log({- message: `Daily notification digest cron failed. \n\nError: ${(error as Error).message}`,- type: "cron",- mention: true,- });- return NextResponse.json({ error: (error as Error).message });- }-}diff --git a/app/api/cron/notification-digest/weekly/route.ts b/app/api/cron/notification-digest/weekly/route.tsdeleted file mode 100644index d3a30fa4..00000000--- a/app/api/cron/notification-digest/weekly/route.ts+++ /dev/null@@ -1,32 +0,0 @@-import { NextResponse } from "next/server";--import { receiver } from "@/lib/cron";-import { processNotificationDigest } from "@/lib/notifications/process-digest";-import { log } from "@/lib/utils";--export const maxDuration = 300;--export async function POST(req: Request) {- const body = await req.json();- if (process.env.VERCEL === "1") {- const isValid = await receiver.verify({- signature: req.headers.get("Upstash-Signature") || "",- body: JSON.stringify(body),- });- if (!isValid) {- return new Response("Unauthorized", { status: 401 });- }- }-- try {- const result = await processNotificationDigest("WEEKLY");- return NextResponse.json({ success: true, ...result });- } catch (error) {- await log({- message: `Weekly notification digest cron failed. \n\nError: ${(error as Error).message}`,- type: "cron",- mention: true,- });- return NextResponse.json({ error: (error as Error).message });- }-}diff --git a/components/emails/digest-blocked-access.tsx b/components/emails/digest-blocked-access.tsxdeleted file mode 100644index 18894180..00000000--- a/components/emails/digest-blocked-access.tsx+++ /dev/null@@ -1,109 +0,0 @@-import React from "react";--import {- Body,- Button,- Container,- Head,- Html,- Preview,- Section,- Tailwind,- Text,-} from "@react-email/components";--import { Footer } from "./shared/footer";--type BlockedAccessSummary = {- blockedEmail: string;- resourceName: string;- resourceType: "document" | "dataroom";-};--export default function DigestBlockedAccess({- teamName = "My Team",- attempts = [- { blockedEmail: "[email protected]", resourceName: "Pitch Deck v3", resourceType: "document" as const },- { blockedEmail: "[email protected]", resourceName: "NDA Agreement", resourceType: "document" as const },- { blockedEmail: "[email protected]", resourceName: "Series A Dataroom", resourceType: "dataroom" as const },- ],- totalAttempts = 3,- frequency = "daily",- remainingCount = 0,-}: {- teamName: string;- attempts: BlockedAccessSummary[];- totalAttempts: number;- frequency: "daily" | "weekly";- remainingCount: number;-}) {- const periodLabel = frequency === "daily" ? "yesterday" : "this week";-- return (- <Html>- <Head />- <Preview>- {`${totalAttempts} blocked access attempt${totalAttempts !== 1 ? "s" : ""} ${periodLabel} on ${teamName}`}- </Preview>- <Tailwind>- <Body className="mx-auto my-auto bg-white font-sans">- <Container className="mx-auto my-10 w-[465px] p-5">- <Text className="mb-8 mt-4 text-center text-2xl font-normal">- <span className="font-bold tracking-tighter">Papermark</span>- </Text>- <Text className="mb-8 mt-4 text-center text-xl font-semibold">- {totalAttempts} blocked access attempt- {totalAttempts !== 1 ? "s" : ""} {periodLabel}- </Text>- <Text className="text-sm leading-6 text-black">- The following access attempts were blocked on{" "}- <span className="font-semibold">{teamName}</span> {periodLabel}:- </Text>- <Section className="my-4">- {attempts.map((attempt, i) => (- <Text- key={i}- className="my-1 text-sm leading-6 text-black"- >- •{" "}- <span className="font-semibold">{attempt.blockedEmail}</span>- {" tried to access "}- <span className="font-semibold">{attempt.resourceName}</span>- <span className="text-gray-500">- {" "}- ({attempt.resourceType})- </span>- </Text>- ))}- {remainingCount > 0 ? (- <Text className="my-1 text-sm leading-6 text-gray-500">- + {remainingCount} more attempt- {remainingCount !== 1 ? "s" : ""}- </Text>- ) : null}- </Section>- <Section className="my-8 text-center">- <Button- className="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href="https://app.papermark.com/settings/general"- style={{ padding: "12px 20px" }}- >- Review security settings- </Button>- </Section>- <Footer- footerText={- <>- You received this {frequency} digest because you have blocked- access notifications set to {frequency} on{" "}- <span className="font-semibold">{teamName}</span>. You can- change this in your notification settings.- </>- }- />- </Container>- </Body>- </Tailwind>- </Html>- );-}diff --git a/components/emails/digest-conversation-messages.tsx b/components/emails/digest-conversation-messages.tsxdeleted file mode 100644index 0f052c6e..00000000--- a/components/emails/digest-conversation-messages.tsx+++ /dev/null@@ -1,73 +0,0 @@-import React from "react";--import {- Body,- Button,- Container,- Head,- Html,- Preview,- Section,- Tailwind,- Text,-} from "@react-email/components";--import { Footer } from "./shared/footer";--export default function DigestConversationMessages({- teamName = "My Team",- totalMessages = 5,- frequency = "daily",-}: {- teamName: string;- totalMessages: number;- frequency: "daily" | "weekly";-}) {- const periodLabel = frequency === "daily" ? "yesterday" : "this week";-- return (- <Html>- <Head />- <Preview>- {`${totalMessages} new conversation message${totalMessages !== 1 ? "s" : ""} ${periodLabel} on ${teamName}`}- </Preview>- <Tailwind>- <Body className="mx-auto my-auto bg-white font-sans">- <Container className="mx-auto my-10 w-[465px] p-5">- <Text className="mb-8 mt-4 text-center text-2xl font-normal">- <span className="font-bold tracking-tighter">Papermark</span>- </Text>- <Text className="mb-8 mt-4 text-center text-xl font-semibold">- {totalMessages} new conversation message- {totalMessages !== 1 ? "s" : ""} {periodLabel}- </Text>- <Text className="text-sm leading-6 text-black">- You have {totalMessages} new message- {totalMessages !== 1 ? "s" : ""} across your conversations on{" "}- <span className="font-semibold">{teamName}</span> {periodLabel}.- </Text>- <Section className="my-8 text-center">- <Button- className="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href="https://app.papermark.com/conversations"- style={{ padding: "12px 20px" }}- >- View conversations- </Button>- </Section>- <Footer- footerText={- <>- You received this {frequency} digest because you have- conversation notifications set to {frequency} on{" "}- <span className="font-semibold">{teamName}</span>. You can- change this in your notification settings.- </>- }- />- </Container>- </Body>- </Tailwind>- </Html>- );-}diff --git a/components/emails/digest-dataroom-uploads.tsx b/components/emails/digest-dataroom-uploads.tsxdeleted file mode 100644index fef840d5..00000000--- a/components/emails/digest-dataroom-uploads.tsx+++ /dev/null@@ -1,110 +0,0 @@-import React from "react";--import {- Body,- Button,- Container,- Head,- Html,- Preview,- Section,- Tailwind,- Text,-} from "@react-email/components";--import { Footer } from "./shared/footer";--type UploadSummary = {- dataroomName: string;- fileCount: number;- uploaderEmail?: string;-};--export default function DigestDataroomUploads({- teamName = "My Team",- uploads = [- { dataroomName: "Series A Dataroom", fileCount: 3, uploaderEmail: "[email protected]" },- { dataroomName: "Due Diligence Room", fileCount: 1, uploaderEmail: "[email protected]" },- ],- totalUploads = 4,- frequency = "daily",- remainingCount = 0,-}: {- teamName: string;- uploads: UploadSummary[];- totalUploads: number;- frequency: "daily" | "weekly";- remainingCount: number;-}) {- const periodLabel = frequency === "daily" ? "yesterday" : "this week";-- return (- <Html>- <Head />- <Preview>- {`${totalUploads} data room upload${totalUploads !== 1 ? "s" : ""} ${periodLabel} on ${teamName}`}- </Preview>- <Tailwind>- <Body className="mx-auto my-auto bg-white font-sans">- <Container className="mx-auto my-10 w-[465px] p-5">- <Text className="mb-8 mt-4 text-center text-2xl font-normal">- <span className="font-bold tracking-tighter">Papermark</span>- </Text>- <Text className="mb-8 mt-4 text-center text-xl font-semibold">- {totalUploads} data room upload{totalUploads !== 1 ? "s" : ""}{" "}- {periodLabel}- </Text>- <Text className="text-sm leading-6 text-black">- Viewers uploaded files to data rooms on{" "}- <span className="font-semibold">{teamName}</span> {periodLabel}:- </Text>- <Section className="my-4">- {uploads.map((upload, i) => (- <Text- key={i}- className="my-1 text-sm leading-6 text-black"- >- •{" "}- <span className="font-semibold">{upload.dataroomName}</span>- {" — "}- {upload.fileCount} file{upload.fileCount !== 1 ? "s" : ""}- {upload.uploaderEmail ? (- <span className="text-gray-500">- {" "}- (by {upload.uploaderEmail})- </span>- ) : null}- </Text>- ))}- {remainingCount > 0 ? (- <Text className="my-1 text-sm leading-6 text-gray-500">- + {remainingCount} more data room- {remainingCount !== 1 ? "s" : ""}- </Text>- ) : null}- </Section>- <Section className="my-8 text-center">- <Button- className="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href="https://app.papermark.com/datarooms"- style={{ padding: "12px 20px" }}- >- View all data rooms- </Button>- </Section>- <Footer- footerText={- <>- You received this {frequency} digest because you have data- room upload notifications set to {frequency} on{" "}- <span className="font-semibold">{teamName}</span>. You can- change this in your notification settings.- </>- }- />- </Container>- </Body>- </Tailwind>- </Html>- );-}diff --git a/components/emails/digest-dataroom-views.tsx b/components/emails/digest-dataroom-views.tsxdeleted file mode 100644index ca74d687..00000000--- a/components/emails/digest-dataroom-views.tsx+++ /dev/null@@ -1,110 +0,0 @@-import React from "react";--import {- Body,- Button,- Container,- Head,- Html,- Preview,- Section,- Tailwind,- Text,-} from "@react-email/components";--import { Footer } from "./shared/footer";--type DataroomViewSummary = {- dataroomName: string;- viewCount: number;- linkName?: string;-};--export default function DigestDataroomViews({- teamName = "My Team",- datarooms = [- { dataroomName: "Series A Dataroom", viewCount: 8, linkName: "Investor Link" },- { dataroomName: "Due Diligence Room", viewCount: 4, linkName: "Legal Link" },- ],- totalViews = 12,- frequency = "daily",- remainingCount = 0,-}: {- teamName: string;- datarooms: DataroomViewSummary[];- totalViews: number;- frequency: "daily" | "weekly";- remainingCount: number;-}) {- const periodLabel = frequency === "daily" ? "yesterday" : "this week";-- return (- <Html>- <Head />- <Preview>- {`${totalViews} data room visit${totalViews !== 1 ? "s" : ""} ${periodLabel} on ${teamName}`}- </Preview>- <Tailwind>- <Body className="mx-auto my-auto bg-white font-sans">- <Container className="mx-auto my-10 w-[465px] p-5">- <Text className="mb-8 mt-4 text-center text-2xl font-normal">- <span className="font-bold tracking-tighter">Papermark</span>- </Text>- <Text className="mb-8 mt-4 text-center text-xl font-semibold">- {totalViews} data room visit{totalViews !== 1 ? "s" : ""}{" "}- {periodLabel}- </Text>- <Text className="text-sm leading-6 text-black">- Here's a summary of data room visits on{" "}- <span className="font-semibold">{teamName}</span> {periodLabel}:- </Text>- <Section className="my-4">- {datarooms.map((dr, i) => (- <Text- key={i}- className="my-1 text-sm leading-6 text-black"- >- •{" "}- <span className="font-semibold">{dr.dataroomName}</span>- {" — "}- {dr.viewCount} visit{dr.viewCount !== 1 ? "s" : ""}- {dr.linkName ? (- <span className="text-gray-500">- {" "}- (via {dr.linkName})- </span>- ) : null}- </Text>- ))}- {remainingCount > 0 ? (- <Text className="my-1 text-sm leading-6 text-gray-500">- + {remainingCount} more data room- {remainingCount !== 1 ? "s" : ""}- </Text>- ) : null}- </Section>- <Section className="my-8 text-center">- <Button- className="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href="https://app.papermark.com/datarooms"- style={{ padding: "12px 20px" }}- >- View all data rooms- </Button>- </Section>- <Footer- footerText={- <>- You received this {frequency} digest because you have data- room visit notifications set to {frequency} on{" "}- <span className="font-semibold">{teamName}</span>. You can- change this in your notification settings.- </>- }- />- </Container>- </Body>- </Tailwind>- </Html>- );-}diff --git a/components/emails/digest-document-views.tsx b/components/emails/digest-document-views.tsxdeleted file mode 100644index 8fa19b8c..00000000--- a/components/emails/digest-document-views.tsx+++ /dev/null@@ -1,111 +0,0 @@-import React from "react";--import {- Body,- Button,- Container,- Head,- Html,- Preview,- Section,- Tailwind,- Text,-} from "@react-email/components";--import { Footer } from "./shared/footer";--type DocumentViewSummary = {- documentName: string;- viewCount: number;- linkName?: string;-};--export default function DigestDocumentViews({- teamName = "My Team",- documents = [- { documentName: "Pitch Deck v3", viewCount: 18, linkName: "Investor Link" },- { documentName: "NDA Agreement", viewCount: 12, linkName: "Legal Review" },- { documentName: "Product Overview", viewCount: 9, linkName: "Sales Demo" },- ],- totalViews = 47,- frequency = "daily",- remainingCount = 2,-}: {- teamName: string;- documents: DocumentViewSummary[];- totalViews: number;- frequency: "daily" | "weekly";- remainingCount: number;-}) {- const periodLabel = frequency === "daily" ? "yesterday" : "this week";-- return (- <Html>- <Head />- <Preview>- {`${totalViews} document view${totalViews !== 1 ? "s" : ""} ${periodLabel} on ${teamName}`}- </Preview>- <Tailwind>- <Body className="mx-auto my-auto bg-white font-sans">- <Container className="mx-auto my-10 w-[465px] p-5">- <Text className="mb-8 mt-4 text-center text-2xl font-normal">- <span className="font-bold tracking-tighter">Papermark</span>- </Text>- <Text className="mb-8 mt-4 text-center text-xl font-semibold">- {totalViews} document view{totalViews !== 1 ? "s" : ""}{" "}- {periodLabel}- </Text>- <Text className="text-sm leading-6 text-black">- Here's a summary of document views on{" "}- <span className="font-semibold">{teamName}</span> {periodLabel}:- </Text>- <Section className="my-4">- {documents.map((doc, i) => (- <Text- key={i}- className="my-1 text-sm leading-6 text-black"- >- •{" "}- <span className="font-semibold">{doc.documentName}</span>- {" — "}- {doc.viewCount} view{doc.viewCount !== 1 ? "s" : ""}- {doc.linkName ? (- <span className="text-gray-500">- {" "}- (via {doc.linkName})- </span>- ) : null}- </Text>- ))}- {remainingCount > 0 ? (- <Text className="my-1 text-sm leading-6 text-gray-500">- + {remainingCount} more document- {remainingCount !== 1 ? "s" : ""}- </Text>- ) : null}- </Section>- <Section className="my-8 text-center">- <Button- className="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href="https://app.papermark.com/documents"- style={{ padding: "12px 20px" }}- >- View all documents- </Button>- </Section>- <Footer- footerText={- <>- You received this {frequency} digest because you have document- view notifications set to {frequency} on{" "}- <span className="font-semibold">{teamName}</span>. You can- change this in your notification settings.- </>- }- />- </Container>- </Body>- </Tailwind>- </Html>- );-}diff --git a/lib/notifications/process-digest.ts b/lib/notifications/process-digest.tsdeleted file mode 100644index a80a2672..00000000--- a/lib/notifications/process-digest.ts+++ /dev/null@@ -1,297 +0,0 @@-import DigestBlockedAccess from "@/components/emails/digest-blocked-access";-import DigestConversationMessages from "@/components/emails/digest-conversation-messages";-import DigestDataroomUploads from "@/components/emails/digest-dataroom-uploads";-import DigestDataroomViews from "@/components/emails/digest-dataroom-views";-import DigestDocumentViews from "@/components/emails/digest-document-views";-import { limiter } from "@/lib/cron";-import prisma from "@/lib/prisma";-import { sendEmail } from "@/lib/resend";-import { log } from "@/lib/utils";-import type { TeamNotificationType } from "@/lib/zod/schemas/notifications";--const MAX_ITEMS = 5;--type DigestGroup = {- userId: string;- teamId: string;- type: TeamNotificationType;- email: string;- teamName: string;- items: Record<string, unknown>[];-};--export async function processNotificationDigest(- frequency: "DAILY" | "WEEKLY",-) {- const preferences = await prisma.notificationPreference.findMany({- where: { frequency },- select: {- userId: true,- teamId: true,- type: true,- },- });-- if (preferences.length === 0) {- return { processed: 0, sent: 0 };- }-- const prefKeys = new Set(- preferences.map((p) => `${p.userId}:${p.teamId}:${p.type}`),- );-- const digestItems = await prisma.notificationDigest.findMany({- where: {- processedAt: null,- },- orderBy: { createdAt: "asc" },- });-- if (digestItems.length === 0) {- return { processed: 0, sent: 0 };- }-- const groups = new Map<string, DigestGroup>();-- for (const item of digestItems) {- const key = `${item.userId}:${item.teamId}:${item.type}`;- if (!prefKeys.has(key)) continue;-- if (!groups.has(key)) {- groups.set(key, {- userId: item.userId,- teamId: item.teamId,- type: item.type as TeamNotificationType,- email: "",- teamName: "",- items: [],- });- }- groups.get(key)!.items.push(item.payload as Record<string, unknown>);- }-- if (groups.size === 0) {- return { processed: 0, sent: 0 };- }-- const userIds = [...new Set([...groups.values()].map((g) => g.userId))];- const teamIds = [...new Set([...groups.values()].map((g) => g.teamId))];-- const [users, teams] = await Promise.all([- prisma.user.findMany({- where: { id: { in: userIds } },- select: { id: true, email: true },- }),- prisma.team.findMany({- where: { id: { in: teamIds } },- select: { id: true, name: true },- }),- ]);-- const userMap = new Map(users.map((u) => [u.id, u.email]));- const teamMap = new Map(teams.map((t) => [t.id, t.name]));-- for (const group of groups.values()) {- group.email = userMap.get(group.userId) || "";- group.teamName = teamMap.get(group.teamId) || "Unknown Team";- }-- let sent = 0;- const digestItemIds = digestItems.map((i) => i.id);- const frequencyLabel: "daily" | "weekly" =- frequency === "DAILY" ? "daily" : "weekly";-- for (const group of groups.values()) {- if (!group.email || group.items.length === 0) continue;-- try {- await limiter.schedule(() =>- sendDigestEmail(group, frequencyLabel),- );- sent++;- } catch (error) {- await log({- message: `Failed to send ${frequencyLabel} ${group.type} digest to ${group.email}. Error: ${(error as Error).message}`,- type: "error",- });- }- }-- await prisma.notificationDigest.updateMany({- where: { id: { in: digestItemIds } },- data: { processedAt: new Date() },- });-- return { processed: digestItems.length, sent };-}--async function sendDigestEmail(- group: DigestGroup,- frequency: "daily" | "weekly",-) {- const { subject, react } = buildDigestEmail(group, frequency);-- await sendEmail({- to: group.email,- subject,- react,- system: true,- test: process.env.NODE_ENV === "development",- });-}--function buildDigestEmail(- group: DigestGroup,- frequency: "daily" | "weekly",-): { subject: string; react: React.ReactElement } {- const periodLabel = frequency === "daily" ? "yesterday" : "this week";- const totalCount = group.items.length;-- switch (group.type) {- case "DOCUMENT_VIEW": {- const docCounts = new Map<string, { count: number; linkName?: string }>();- for (const item of group.items) {- const name = (item.documentName as string) || "Unknown Document";- const existing = docCounts.get(name);- docCounts.set(name, {- count: (existing?.count || 0) + 1,- linkName: (item.linkName as string) || existing?.linkName,- });- }- const sorted = [...docCounts.entries()].sort(- (a, b) => b[1].count - a[1].count,- );- const top = sorted.slice(0, MAX_ITEMS);- const remaining = Math.max(0, sorted.length - MAX_ITEMS);-- return {- subject: `${totalCount} document view${totalCount > 1 ? "s" : ""} ${periodLabel} on ${group.teamName}`,- react: DigestDocumentViews({- teamName: group.teamName,- documents: top.map(([name, data]) => ({- documentName: name,- viewCount: data.count,- linkName: data.linkName,- })),- totalViews: totalCount,- frequency,- remainingCount: remaining,- }),- };- }-- case "DATAROOM_VIEW": {- const drCounts = new Map<string, { count: number; linkName?: string }>();- for (const item of group.items) {- const name = (item.dataroomName as string) || "Unknown Data Room";- const existing = drCounts.get(name);- drCounts.set(name, {- count: (existing?.count || 0) + 1,- linkName: (item.linkName as string) || existing?.linkName,- });- }- const sorted = [...drCounts.entries()].sort(- (a, b) => b[1].count - a[1].count,- );- const top = sorted.slice(0, MAX_ITEMS);- const remaining = Math.max(0, sorted.length - MAX_ITEMS);-- return {- subject: `${totalCount} data room visit${totalCount > 1 ? "s" : ""} ${periodLabel} on ${group.teamName}`,- react: DigestDataroomViews({- teamName: group.teamName,- datarooms: top.map(([name, data]) => ({- dataroomName: name,- viewCount: data.count,- linkName: data.linkName,- })),- totalViews: totalCount,- frequency,- remainingCount: remaining,- }),- };- }-- case "BLOCKED_ACCESS": {- const top = group.items.slice(0, MAX_ITEMS);- const remaining = Math.max(0, totalCount - MAX_ITEMS);-- return {- subject: `${totalCount} blocked access attempt${totalCount > 1 ? "s" : ""} ${periodLabel} on ${group.teamName}`,- react: DigestBlockedAccess({- teamName: group.teamName,- attempts: top.map((item) => ({- blockedEmail: (item.blockedEmail as string) || "Unknown",- resourceName: (item.resourceName as string) || "a resource",- resourceType:- (item.resourceType as "document" | "dataroom") || "document",- })),- totalAttempts: totalCount,- frequency,- remainingCount: remaining,- }),- };- }-- case "DATAROOM_UPLOAD": {- const drUploads = new Map<- string,- { fileCount: number; uploaderEmail?: string }- >();- for (const item of group.items) {- const name = (item.dataroomName as string) || "Unknown Data Room";- const docs = (item.documentNames as string[]) || [];- const existing = drUploads.get(name);- drUploads.set(name, {- fileCount: (existing?.fileCount || 0) + docs.length,- uploaderEmail:- (item.uploaderEmail as string) || existing?.uploaderEmail,- });- }- const sorted = [...drUploads.entries()].sort(- (a, b) => b[1].fileCount - a[1].fileCount,- );- const top = sorted.slice(0, MAX_ITEMS);- const remaining = Math.max(0, sorted.length - MAX_ITEMS);-- return {- subject: `${totalCount} data room upload${totalCount > 1 ? "s" : ""} ${periodLabel} on ${group.teamName}`,- react: DigestDataroomUploads({- teamName: group.teamName,- uploads: top.map(([name, data]) => ({- dataroomName: name,- fileCount: data.fileCount,- uploaderEmail: data.uploaderEmail,- })),- totalUploads: totalCount,- frequency,- remainingCount: remaining,- }),- };- }-- case "CONVERSATION_MESSAGE": {- return {- subject: `${totalCount} new conversation message${totalCount > 1 ? "s" : ""} ${periodLabel} on ${group.teamName}`,- react: DigestConversationMessages({- teamName: group.teamName,- totalMessages: totalCount,- frequency,- }),- };- }-- default: {- return {- subject: `Activity digest ${periodLabel} on ${group.teamName}`,- react: DigestDocumentViews({- teamName: group.teamName,- documents: [],- totalViews: 0,- frequency,- remainingCount: 0,- }),- };- }- }-}diff --git a/lib/notifications/queue-digest.ts b/lib/notifications/queue-digest.tsdeleted file mode 100644index f1694a39..00000000--- a/lib/notifications/queue-digest.ts+++ /dev/null@@ -1,45 +0,0 @@-import { Prisma } from "@prisma/client";--import prisma from "@/lib/prisma";-import type { TeamNotificationType } from "@/lib/zod/schemas/notifications";--export async function queueDigestNotification({- userId,- teamId,- type,- payload,-}: {- userId: string;- teamId: string;- type: TeamNotificationType;- payload: Record<string, unknown>;-}) {- await prisma.notificationDigest.create({- data: {- userId,- teamId,- type,- payload: payload as Prisma.InputJsonValue,- },- });-}--export async function queueDigestNotifications(- items: {- userId: string;- teamId: string;- type: TeamNotificationType;- payload: Record<string, unknown>;- }[],-) {- if (items.length === 0) return;-- await prisma.notificationDigest.createMany({- data: items.map((item) => ({- userId: item.userId,- teamId: item.teamId,- type: item.type,- payload: item.payload as Prisma.InputJsonValue,- })),- });-}