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

Function getDMs

apps/web/services/channels/index.ts:609–634  ·  view source on GitHub ↗
({
  accountId,
  userId,
}: {
  accountId: string;
  userId: string;
})

Source from the content-addressed store, hash-verified

607export default ChannelsService;
608
609export 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
636export async function shouldThisChannelBeAnonymous(channelId: string) {
637 return await prisma.accounts

Callers 2

indexFunction · 0.90
fetchCommonFunction · 0.90

Calls 2

serializeDmFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected