(id: string, model: 'threads' | 'messages')
| 2 | import axios from 'axios'; |
| 3 | |
| 4 | async function getIntegration(id: string, model: 'threads' | 'messages') { |
| 5 | const query = { |
| 6 | where: { id }, |
| 7 | select: { |
| 8 | channel: { |
| 9 | select: { |
| 10 | account: { |
| 11 | select: { |
| 12 | integrationMatrix: true, |
| 13 | }, |
| 14 | }, |
| 15 | }, |
| 16 | }, |
| 17 | }, |
| 18 | }; |
| 19 | const matrix = |
| 20 | model === 'threads' |
| 21 | ? await prisma.threads.findUnique(query) |
| 22 | : await prisma.messages.findUnique(query); |
| 23 | return matrix?.channel.account?.integrationMatrix.find((i) => i.enabled); |
| 24 | } |
| 25 | |
| 26 | export async function matrixNewThread({ |
| 27 | threadId, |
no test coverage detected