Skip to content

Commit

Permalink
Add theme to new list mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
RobVermeer committed Dec 1, 2023
1 parent 3b25c46 commit bc57cfd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/wishlists/createWishlistForUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ export const createWishlistForUser = async (formData: FormData) => {
const userId = session.user.id
const data = wishlistSchema.parse({
name: formData.get("name")?.toString() || undefined,
theme: formData.get("theme")?.toString() || undefined,
groups: formData.getAll("groups").map((group) => group.toString()),
})

await prisma.wishlist.create({
select: wishlistProperties,
data: {
title: data.name || null,
theme: data.theme || null,
groups: { connect: data.groups?.map((id) => ({ id })) },
createdAt: new Date(),
userId,
Expand Down

0 comments on commit bc57cfd

Please sign in to comment.