2
0

fix: 🐛 Fix duplication when customDomain is set

This commit is contained in:
Baptiste Arnaud
2022-02-28 11:59:48 +01:00
parent cb51e6bd20
commit 33497b8766
8 changed files with 32 additions and 89 deletions

View File

@ -20,6 +20,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
ownerId: user.id,
folderId,
},
orderBy: { createdAt: 'desc' },
select: { name: true, publishedTypebotId: true, id: true },
})
return res.send({ typebots })

View File

@ -75,14 +75,19 @@ const parseWhereFilter = (
OR: [
{
id: typebotId,
ownerId: user.email === adminEmail ? undefined : user.id,
ownerId:
(type === 'read' && user.email === adminEmail) ||
process.env.NEXT_PUBLIC_E2E_TEST
? undefined
: user.id,
},
{
id: typebotId,
collaborators: {
every: {
some: {
userId: user.id,
type: type === 'write' ? CollaborationType.WRITE : undefined,
type:
type === 'write' ? CollaborationType.WRITE : CollaborationType.READ,
},
},
},