Function
handleSlack
({
accountId,
syncFrom,
}: {
accountId: string;
syncFrom: Date;
})
Source from the content-addressed store, hash-verified
| 104 | } |
| 105 | |
| 106 | async 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 | |
| 137 | async function handleDiscord({ |
| 138 | accountId, |
Tested by
no test coverage detected