Skip to content

Scheduling infrastructure for absolutely everyone.

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

Anik Dhabal Babu90ce0f8d4da1
diff --git a/packages/trpc/server/routers/viewer/eventTypes/duplicate.handler.ts b/packages/trpc/server/routers/viewer/eventTypes/duplicate.handler.ts
index 7710ef215e7..59370e597c0 100644
--- a/packages/trpc/server/routers/viewer/eventTypes/duplicate.handler.ts
+++ b/packages/trpc/server/routers/viewer/eventTypes/duplicate.handler.ts
@@ -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,