🐛 Remove publicId and customDomain duplication on imported bots
This commit is contained in:
@@ -30,7 +30,7 @@ export const deleteWorkspace = authenticatedProcedure
|
||||
include: { members: true },
|
||||
})
|
||||
|
||||
if (!workspace || (await isAdminWriteWorkspaceForbidden(workspace, user)))
|
||||
if (!workspace || isAdminWriteWorkspaceForbidden(workspace, user))
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No workspaces found' })
|
||||
|
||||
await prisma.workspace.deleteMany({
|
||||
|
||||
@@ -31,7 +31,7 @@ export const getWorkspace = authenticatedProcedure
|
||||
include: { members: true },
|
||||
})
|
||||
|
||||
if (!workspace || (await isReadWorkspaceFobidden(workspace, user)))
|
||||
if (!workspace || isReadWorkspaceFobidden(workspace, user))
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No workspaces found' })
|
||||
|
||||
return {
|
||||
|
||||
@@ -31,7 +31,7 @@ export const listInvitationsInWorkspace = authenticatedProcedure
|
||||
include: { members: true, invitations: true },
|
||||
})
|
||||
|
||||
if (!workspace || (await isReadWorkspaceFobidden(workspace, user)))
|
||||
if (!workspace || isReadWorkspaceFobidden(workspace, user))
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No workspaces found' })
|
||||
|
||||
return { invitations: workspace.invitations }
|
||||
|
||||
@@ -37,7 +37,7 @@ export const listMembersInWorkspace = authenticatedProcedure
|
||||
},
|
||||
})
|
||||
|
||||
if (!workspace || (await isReadWorkspaceFobidden(workspace, user)))
|
||||
if (!workspace || isReadWorkspaceFobidden(workspace, user))
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No workspaces found' })
|
||||
|
||||
return {
|
||||
|
||||
@@ -41,7 +41,7 @@ export const updateWorkspace = authenticatedProcedure
|
||||
if (!workspace)
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'Workspace not found' })
|
||||
|
||||
if (await isAdminWriteWorkspaceForbidden(workspace, user))
|
||||
if (isAdminWriteWorkspaceForbidden(workspace, user))
|
||||
throw new TRPCError({
|
||||
code: 'FORBIDDEN',
|
||||
message: 'You are not allowed to update this workspace',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MemberInWorkspace, User } from '@typebot.io/prisma'
|
||||
|
||||
export const isAdminWriteWorkspaceForbidden = async (
|
||||
export const isAdminWriteWorkspaceForbidden = (
|
||||
workspace: {
|
||||
members: MemberInWorkspace[]
|
||||
},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MemberInWorkspace, User } from '@typebot.io/prisma'
|
||||
|
||||
export const isReadWorkspaceFobidden = async (
|
||||
export const isReadWorkspaceFobidden = (
|
||||
workspace: {
|
||||
members: MemberInWorkspace[]
|
||||
members: Pick<MemberInWorkspace, 'userId'>[]
|
||||
},
|
||||
user: Pick<User, 'email' | 'id'>
|
||||
) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MemberInWorkspace, User } from '@typebot.io/prisma'
|
||||
|
||||
export const isWriteWorkspaceForbidden = async (
|
||||
export const isWriteWorkspaceForbidden = (
|
||||
workspace: {
|
||||
members: MemberInWorkspace[]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user