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

Function handleSlack

apps/web/pages/api/integration-oauth.ts:106–135  ·  view source on GitHub ↗
({
  accountId,
  syncFrom,
}: {
  accountId: string;
  syncFrom: Date;
})

Source from the content-addressed store, hash-verified

104}
105
106async function handleSlack({
107 accountId,
108 syncFrom,
109}: {
110 accountId: string;
111 syncFrom: Date;
112}) {
113 const auths = await prisma.slackAuthorizations.findFirst({
114 where: { accountsId: accountId },
115 orderBy: { createdAt: 'desc' },
116 });
117 if (auths) {
118 await prisma.slackAuthorizations.update({
119 data: {
120 syncFrom,
121 },
122 where: { id: auths.id },
123 });
124 } else {
125 await prisma.slackAuthorizations.create({
126 data: {
127 accessToken: 'pending',
128 scope: 'pending',
129 botUserId: 'pending',
130 accountsId: accountId,
131 syncFrom,
132 },
133 });
134 }
135}
136
137async function handleDiscord({
138 accountId,

Callers 1

handlerFunction · 0.85

Calls 2

updateMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected