fix: hosts not set when duplicating team event-type (#15012)

Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
This commit is contained in:
Anik Dhabal Babu
2024-05-15 18:07:22 +00:00
committed by GitHub
co-authored by Carina Wollendorfer
parent 5e9902921f
commit 90ce0f8d4d
@@ -38,6 +38,7 @@ export const duplicateHandler = async ({ ctx, input }: DuplicateOptions) => {
id: true,
},
},
hosts: true,
team: true,
workflows: true,
webhooks: true,
@@ -70,6 +71,7 @@ export const duplicateHandler = async ({ ctx, input }: DuplicateOptions) => {
users,
locations,
team,
hosts,
recurringEvent,
bookingLimits,
durationLimits,
@@ -99,6 +101,14 @@ export const duplicateHandler = async ({ ctx, input }: DuplicateOptions) => {
locations: locations ?? undefined,
team: team ? { connect: { id: team.id } } : undefined,
users: users ? { connect: users.map((user) => ({ id: user.id })) } : undefined,
hosts: hosts
? {
createMany: {
data: hosts.map(({ eventTypeId: _, ...rest }) => rest),
},
}
: undefined,
recurringEvent: recurringEvent || undefined,
bookingLimits: bookingLimits ?? undefined,
durationLimits: durationLimits ?? undefined,