({
accountId,
userId,
}: {
accountId: string;
userId: string;
})
| 607 | export default ChannelsService; |
| 608 | |
| 609 | export async function getDMs({ |
| 610 | accountId, |
| 611 | userId, |
| 612 | }: { |
| 613 | accountId: string; |
| 614 | userId: string; |
| 615 | }) { |
| 616 | return await prisma.channels |
| 617 | .findMany({ |
| 618 | include: { |
| 619 | memberships: { |
| 620 | select: { |
| 621 | user: true, |
| 622 | archived: true, |
| 623 | }, |
| 624 | }, |
| 625 | }, |
| 626 | where: { |
| 627 | accountId, |
| 628 | type: ChannelType.DM, |
| 629 | memberships: { some: { usersId: userId } }, |
| 630 | }, |
| 631 | orderBy: { createdAt: 'desc' }, |
| 632 | }) |
| 633 | .then((e) => e.map(serializeDm(userId))); |
| 634 | } |
| 635 | |
| 636 | export async function shouldThisChannelBeAnonymous(channelId: string) { |
| 637 | return await prisma.accounts |
no test coverage detected