Skip to content

Commit

Permalink
🧑‍💻 (api) Add icon field in create workspace endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 24, 2023
1 parent 6864667 commit 69254c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/builder/src/features/workspace/api/createWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const createWorkspace = authenticatedProcedure
tags: ['Workspace'],
},
})
.input(workspaceSchema.pick({ name: true }))
.input(z.object({ icon: z.string().optional(), name: z.string() }))
.output(
z.object({
workspace: workspaceSchema,
})
)
.mutation(async ({ input: { name }, ctx: { user } }) => {
.mutation(async ({ input: { name, icon }, ctx: { user } }) => {
const existingWorkspaceNames = (await prisma.workspace.findMany({
where: {
members: {
Expand All @@ -45,6 +45,7 @@ export const createWorkspace = authenticatedProcedure
const newWorkspace = (await prisma.workspace.create({
data: {
name,
icon,
members: { create: [{ role: 'ADMIN', userId: user.id }] },
plan,
},
Expand Down

0 comments on commit 69254c3

Please sign in to comment.