Skip to content

Duplicate an event type #17

Description

@shockalotti

Requested in #16.

Let hosts duplicate an existing event type from the Event types list, so building several variants that share configuration (location, duration, buffers, booking window) doesn't mean re-entering everything by hand.

The thing to get right

An event type is not just its row in event_types. It owns:

What Where
Intake questions questions.event_type_id
Hosts, with role + routing priority event_type_hosts
Event-scoped availability availability_rules.event_type_id (NULL means the global default)
Per-event email / reminder copy event_types.msg_*, event_type_reminders

A row-only copy produces a clone that looks correct in the editor while having no questions, no hosts, and silently falling back to global availability. That is worse than not shipping the feature, because the failure is invisible until a booker hits the page or a booking lands on the wrong person.

Scope

  • POST /v1/event-types/{slug}/duplicate (or equivalent) copying the row plus all four child sets above
  • Slug uniquified (intro-call to intro-call-copy, then -2 etc. on collision; the column is UNIQUE)
  • Copy starts with is_active = 0 so a half-configured clone isn't live at a guessable URL
  • Copy price_cents / currency faithfully rather than zeroing them, so nobody accidentally publishes a paid event type at zero
  • Do not copy bookings (bookings.event_type_id is ON DELETE RESTRICT)
  • Duplicate action in the event-types list UI, consistent with the existing row actions (ghost icon button + Tooltip)
  • Tests asserting each child set came across, not just that the new row exists

Notes for whoever picks this up

  • The whole copy must be one transaction. The DB pool is MaxOpenConns(1); never query inside an open rows cursor, materialise to a slice first.
  • UI conventions are in CLAUDE.md (shadcn-svelte, no hand-rolled buttons/modals).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions