2
0

(dashboard) Improve folders and typebots get queries

This commit is contained in:
Baptiste Arnaud
2022-12-12 09:06:54 +01:00
parent 141ffd35f7
commit 3ab047a487
2 changed files with 7 additions and 23 deletions

View File

@@ -24,29 +24,14 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
workspaceId: workspaceId, workspaceId: workspaceId,
}, },
{ {
OR: [ workspace: {
{ members: {
workspace: { some: {
members: { userId: user.id,
some: { role: { not: WorkspaceRole.GUEST },
userId: user.id,
role: { not: WorkspaceRole.GUEST },
},
},
}, },
}, },
{ },
typebots: {
some: {
collaborators: {
some: {
userId: user.id,
},
},
},
},
},
],
}, },
], ],
}, },

View File

@@ -1,5 +1,5 @@
import { withSentry } from '@sentry/nextjs' import { withSentry } from '@sentry/nextjs'
import { Plan, Prisma, WorkspaceRole } from 'db' import { Plan, WorkspaceRole } from 'db'
import prisma from '@/lib/prisma' import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next' import { NextApiRequest, NextApiResponse } from 'next'
import { import {
@@ -73,7 +73,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
some: { userId: user.id, role: WorkspaceRole.GUEST }, some: { userId: user.id, role: WorkspaceRole.GUEST },
}, },
}, },
collaborators: { some: { userId: user.id } },
}, },
], ],
}, },