MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / syncMemberships

Function syncMemberships

apps/web/services/slack/sync/membership.ts:4–33  ·  view source on GitHub ↗
({
  accountId,
  channelId,
  externalChannelId,
  token,
  getMemberships,
}: {
  accountId: string;
  channelId: string;
  externalChannelId: string;
  token: string;
  getMemberships: GetMembershipsFnType;
})

Source from the content-addressed store, hash-verified

2import { GetMembershipsFnType } from '../types';
3
4export async function syncMemberships({
5 accountId,
6 channelId,
7 externalChannelId,
8 token,
9 getMemberships,
10}: {
11 accountId: string;
12 channelId: string;
13 externalChannelId: string;
14 token: string;
15 getMemberships: GetMembershipsFnType;
16}) {
17 const members = await getMemberships(externalChannelId, token);
18 if (members && members.length) {
19 for (const member of members) {
20 await createMembership({
21 channel: { connect: { id: channelId } },
22 user: {
23 connect: {
24 externalUserId_accountsId: {
25 accountsId: accountId,
26 externalUserId: member,
27 },
28 },
29 },
30 });
31 }
32 }
33}

Callers 1

syncWrapperFunction · 0.90

Calls 2

createMembershipFunction · 0.90
getMembershipsFunction · 0.85

Tested by

no test coverage detected