feat: Custom host location (#25916)

* chore: save progress

* chore:

* feat: add input dialog

* fix: type error

* feat: mass apply dialog

* test: per host location

* test: fix test

* fix: address Cubic AI review feedback (confidence >= 9/10)

- Remove PII (address, phone number) from tracing logs in RegularBookingService.ts
- Constrain HostLocation.type to EventLocationType["type"] for compile-time validation

Co-Authored-By: unknown <>

* fix: translation

* refactor: improvements

* fix: correct grammar in custom host locations tooltip

Change 'custom host locations is enabled' to 'custom host locations are enabled' (plural subject requires plural verb).

Addresses Cubic AI review feedback (confidence 9/10).

Co-Authored-By: unknown <>

* refactor: improvements

* fix: auth

* fix: check

* refactor: improvements

* fix: address Cubic AI review feedback (confidence >= 9/10)

- Add scheduleId to newly created hosts in update.handler.ts to persist
  host-specific schedules during create operations
- Change host location deletion filter from !host.location to
  host.location === null to only delete when explicitly set to null
- Fix static-link per-host locations to use actual link instead of type
  in locationBodyString for bookingLocationService.ts

Co-Authored-By: unknown <>

* fix: preserve existing host scheduleId when not explicitly provided

Change scheduleId handling for existing hosts from 'host.scheduleId ?? null'
to 'host.scheduleId === undefined ? undefined : host.scheduleId' so that
when the client doesn't provide a scheduleId, the existing value is preserved
instead of being cleared to null.

Co-Authored-By: unknown <>

* fix; type erro

* fix; type erro

* fix; type erro

* refactor: move repository

* refactor: move repository

* fix: add singular/plural translations for location_applied_to_hosts

Addresses Cubic AI review feedback (confidence 9/10) to fix '1 hosts' rendering as '1 host' by using i18next plural format with _one and _other suffixes.

Co-Authored-By: unknown <>

* refactor: feedback

* fix: type err

* fix: use uuid in schema and remove attendee locaiton

* fix: type err

* fix: type err

* fix: validate eventTypeId as integer in massApplyHostLocation schema

Co-Authored-By: unknown <>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-01-23 11:18:43 -03:00
1 parent b9b7e50f5a
commit 0ad4367005
33 files changed
+2625 -68

No files matched your search

@@ -0,0 +1,33 @@
-- AlterTable
ALTER TABLE "public"."EventType" ADD COLUMN "enablePerHostLocations" BOOLEAN NOT NULL DEFAULT false;
-- CreateTable
CREATE TABLE "public"."HostLocation" (
"id" TEXT NOT NULL,
"userId" INTEGER NOT NULL,
"eventTypeId" INTEGER NOT NULL,
"type" TEXT NOT NULL,
"credentialId" INTEGER,
"link" TEXT,
"address" TEXT,
"phoneNumber" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "HostLocation_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "HostLocation_credentialId_idx" ON "public"."HostLocation"("credentialId");
-- CreateIndex
CREATE INDEX "HostLocation_eventTypeId_idx" ON "public"."HostLocation"("eventTypeId");
-- CreateIndex
CREATE UNIQUE INDEX "HostLocation_userId_eventTypeId_key" ON "public"."HostLocation"("userId", "eventTypeId");
-- AddForeignKey
ALTER TABLE "public"."HostLocation" ADD CONSTRAINT "HostLocation_userId_eventTypeId_fkey" FOREIGN KEY ("userId", "eventTypeId") REFERENCES "public"."Host"("userId", "eventTypeId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "public"."HostLocation" ADD CONSTRAINT "HostLocation_credentialId_fkey" FOREIGN KEY ("credentialId") REFERENCES "public"."Credential"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+29 -7
View File
@@ -59,22 +59,23 @@ enum CreationSource {
}
model Host {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
eventTypeId Int
isFixed Boolean @default(false)
isFixed Boolean @default(false)
priority Int?
weight Int?
// weightAdjustment is deprecated. We not calculate the calibratino value on the spot. Plan to drop this column.
weightAdjustment Int?
schedule Schedule? @relation(fields: [scheduleId], references: [id])
schedule Schedule? @relation(fields: [scheduleId], references: [id])
scheduleId Int?
createdAt DateTime @default(now())
group HostGroup? @relation(fields: [groupId], references: [id])
createdAt DateTime @default(now())
group HostGroup? @relation(fields: [groupId], references: [id])
groupId String?
memberId Int?
member Membership? @relation(fields: [memberId], references: [id], onDelete: Cascade)
member Membership? @relation(fields: [memberId], references: [id], onDelete: Cascade)
location HostLocation?
@@id([userId, eventTypeId])
@@index([memberId])
@@ -96,6 +97,25 @@ model HostGroup {
@@index([eventTypeId])
}
model HostLocation {
id String @id @default(uuid())
userId Int
eventTypeId Int
host Host @relation(fields: [userId, eventTypeId], references: [userId, eventTypeId], onDelete: Cascade)
type String
credentialId Int?
credential Credential? @relation(fields: [credentialId], references: [id], onDelete: SetNull)
link String?
address String?
phoneNumber String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([userId, eventTypeId])
@@index([credentialId])
@@index([eventTypeId])
}
model CalVideoSettings {
eventTypeId Int @id
eventType EventType @relation(fields: [eventTypeId], references: [id], onDelete: Cascade)
@@ -259,6 +279,7 @@ model EventType {
bookingRequiresAuthentication Boolean @default(false)
rrHostSubsetEnabled Boolean @default(false)
enablePerHostLocations Boolean @default(false)
createdAt DateTime? @default(now())
updatedAt DateTime? @updatedAt
@@ -304,6 +325,7 @@ model Credential {
delegationCredentialId String?
delegationCredential DelegationCredential? @relation(fields: [delegationCredentialId], references: [id], onDelete: Cascade)
integrationAttributeSyncs IntegrationAttributeSync[]
hostLocations HostLocation[]
@@index([appId])
@@index([subscriptionId])