MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / updateThreadMetrics

Function updateThreadMetrics

apps/web/services/threads/metrics.ts:3–12  ·  view source on GitHub ↗
(
  threadId: string,
  lastMessage: { sentAt: Date; author: users | null },
  field: 'firstManagerReplyAt' | 'firstUserReplyAt'
)

Source from the content-addressed store, hash-verified

1import { Roles, users, prisma } from '@linen/database';
2
3export async function updateThreadMetrics(
4 threadId: string,
5 lastMessage: { sentAt: Date; author: users | null },
6 field: 'firstManagerReplyAt' | 'firstUserReplyAt'
7) {
8 await prisma.threads.update({
9 where: { id: threadId },
10 data: { [field]: lastMessage.sentAt.getTime() },
11 });
12}
13
14export async function getFirstAndLastMessages(
15 threadId: string,

Callers 1

updateMetricsMethod · 0.90

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected