( threadId: string, messageId: string )
| 12 | } |
| 13 | |
| 14 | export async function getFirstAndLastMessages( |
| 15 | threadId: string, |
| 16 | messageId: string |
| 17 | ) { |
| 18 | return await Promise.all([ |
| 19 | prisma.messages.findFirst({ |
| 20 | where: { threads: { id: threadId } }, |
| 21 | take: 1, |
| 22 | orderBy: { sentAt: 'asc' }, |
| 23 | select: { author: true }, |
| 24 | }), |
| 25 | prisma.messages.findFirst({ |
| 26 | where: { id: messageId }, |
| 27 | select: { author: true, sentAt: true }, |
| 28 | }), |
| 29 | ]); |
| 30 | } |
| 31 | |
| 32 | export function isReplierMember( |
| 33 | thread: { |