(accountId: string)
| 2 | import { config } from 'config'; |
| 3 | |
| 4 | export async function findOrCreateLinenBot(accountId: string) { |
| 5 | let linenBot = await prisma.users.findUnique({ |
| 6 | where: { |
| 7 | externalUserId_accountsId: { |
| 8 | accountsId: accountId, |
| 9 | externalUserId: config.linen.bot.externalId, |
| 10 | }, |
| 11 | }, |
| 12 | }); |
| 13 | if (!linenBot) { |
| 14 | linenBot = await prisma.users.create({ |
| 15 | data: { |
| 16 | isAdmin: false, |
| 17 | isBot: true, |
| 18 | accountsId: accountId, |
| 19 | externalUserId: config.linen.bot.externalId, |
| 20 | displayName: config.linen.bot.displayName, |
| 21 | profileImageUrl: config.linen.squareLogo, |
| 22 | }, |
| 23 | }); |
| 24 | } |
| 25 | return linenBot; |
| 26 | } |
no test coverage detected