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

Function handleDiscord

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

Source from the content-addressed store, hash-verified

135}
136
137async function handleDiscord({
138 accountId,
139 syncFrom,
140}: {
141 accountId: string;
142 syncFrom: Date;
143}) {
144 const auths = await prisma.discordAuthorizations.findFirst({
145 where: { accountsId: accountId },
146 orderBy: { createdAt: 'desc' },
147 });
148 if (auths) {
149 await prisma.discordAuthorizations.update({
150 data: {
151 syncFrom,
152 },
153 where: { id: auths.id },
154 });
155 } else {
156 await prisma.discordAuthorizations.create({
157 data: {
158 accountsId: accountId,
159 accessToken: 'pending',
160 scope: 'pending',
161 syncFrom,
162 },
163 });
164 }
165}

Callers 1

handlerFunction · 0.85

Calls 2

updateMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected