🐛 Fix api doc CORS
This commit is contained in:
@ -31,7 +31,7 @@ export const createWorkspaceProcedure = authenticatedProcedure
|
||||
},
|
||||
},
|
||||
select: { name: true },
|
||||
})) satisfies Pick<Workspace, 'name'>[]
|
||||
})) as Pick<Workspace, 'name'>[]
|
||||
|
||||
if (existingWorkspaceNames.some((workspace) => workspace.name === name))
|
||||
throw new TRPCError({
|
||||
@ -48,7 +48,7 @@ export const createWorkspaceProcedure = authenticatedProcedure
|
||||
members: { create: [{ role: 'ADMIN', userId: user.id }] },
|
||||
plan,
|
||||
},
|
||||
})) satisfies Workspace
|
||||
})) as Workspace
|
||||
|
||||
return {
|
||||
workspace: newWorkspace,
|
||||
|
@ -27,7 +27,7 @@ export const getWorkspaceProcedure = authenticatedProcedure
|
||||
.query(async ({ input: { workspaceId }, ctx: { user } }) => {
|
||||
const workspace = (await prisma.workspace.findFirst({
|
||||
where: { members: { some: { userId: user.id } }, id: workspaceId },
|
||||
})) satisfies Workspace | null
|
||||
})) as Workspace | null
|
||||
|
||||
if (!workspace)
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No workspaces found' })
|
||||
|
@ -31,7 +31,7 @@ export const listInvitationsInWorkspaceProcedure = authenticatedProcedure
|
||||
workspace: { members: { some: { userId: user.id } } },
|
||||
},
|
||||
select: { createdAt: true, email: true, type: true },
|
||||
})) satisfies WorkspaceInvitation[]
|
||||
})) as WorkspaceInvitation[]
|
||||
|
||||
if (!invitations)
|
||||
throw new TRPCError({
|
||||
|
@ -28,7 +28,7 @@ export const listMembersInWorkspaceProcedure = authenticatedProcedure
|
||||
const members = (await prisma.memberInWorkspace.findMany({
|
||||
where: { userId: user.id, workspaceId },
|
||||
include: { user: { select: { name: true, email: true, image: true } } },
|
||||
})) satisfies WorkspaceMember[]
|
||||
})) as WorkspaceMember[]
|
||||
|
||||
if (!members)
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No members found' })
|
||||
|
@ -26,7 +26,7 @@ export const listWorkspacesProcedure = authenticatedProcedure
|
||||
const workspaces = (await prisma.workspace.findMany({
|
||||
where: { members: { some: { userId: user.id } } },
|
||||
select: { name: true, id: true, icon: true, plan: true },
|
||||
})) satisfies Pick<Workspace, 'id' | 'name' | 'icon' | 'plan'>[]
|
||||
})) as Pick<Workspace, 'id' | 'name' | 'icon' | 'plan'>[]
|
||||
|
||||
if (!workspaces)
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No workspaces found' })
|
||||
|
@ -34,7 +34,7 @@ export const updateWorkspaceProcedure = authenticatedProcedure
|
||||
|
||||
const workspace = (await prisma.workspace.findFirst({
|
||||
where: { members: { some: { userId: user.id } }, id: workspaceId },
|
||||
})) satisfies Workspace | null
|
||||
})) as Workspace | null
|
||||
|
||||
if (!workspace)
|
||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'Workspace not found' })
|
||||
|
Reference in New Issue
Block a user