(
threadId: string,
lastMessage: { sentAt: Date; author: users | null },
field: 'firstManagerReplyAt' | 'firstUserReplyAt'
)
| 1 | import { Roles, users, prisma } from '@linen/database'; |
| 2 | |
| 3 | export 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 | |
| 14 | export async function getFirstAndLastMessages( |
| 15 | threadId: string, |