🧑‍💻 (api) Add icon field in create workspace endpoint

This commit is contained in:
Baptiste Arnaud
2023-06-24 10:26:38 +02:00
parent 6864667297
commit 69254c3624

View File

@@ -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: {
@@ -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,
},