Files
calendar/packages/prisma/migrations/20250122083420_create_internal_notes_tables/migration.sql
T
656d6dc195 feat: Internal Notes for bookings (#18804)
* migration + migrate booking limit page to team settings

* new pages

* use settings toggle for displaying content

* get current team presets

* update mutation

* i18n for settings page

* remove redudant await

* cancelation UI for select

* handle other selection

* extract into a util

* inital cancelation reason flow

* fix i18n to be more readable

* add cancel reason logic

* nits

* improve copy

* ensure is teamMember and not isAdmin for getting internalNotes

* improvie spacing between elements

* fix types

* more type fixes

* correct types

* Update packages/features/bookings/lib/handleNewBooking/getEventTypesFromDB.ts

* use input component and remove mb-2 to allign with icon button

* Update packages/trpc/server/routers/viewer/teams/updateInternalNotesPresets.handler.ts

Co-authored-by: Eunjae Lee <hey@eunjae.dev>

* nits

* type fixs

* fix type

* fix type

* fix nullable option lost in merge

---------

Co-authored-by: Eunjae Lee <hey@eunjae.dev>
2025-01-24 09:26:52 +00:00

53 lines
2.0 KiB
SQL

-- CreateTable
CREATE TABLE "InternalNotePreset" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"cancellationReason" TEXT,
"teamId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "InternalNotePreset_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "BookingInternalNote" (
"id" SERIAL NOT NULL,
"notePresetId" INTEGER,
"text" TEXT,
"bookingId" INTEGER NOT NULL,
"createdById" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "BookingInternalNote_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "InternalNotePreset_teamId_idx" ON "InternalNotePreset"("teamId");
-- CreateIndex
CREATE UNIQUE INDEX "InternalNotePreset_teamId_name_key" ON "InternalNotePreset"("teamId", "name");
-- CreateIndex
CREATE INDEX "BookingInternalNote_bookingId_idx" ON "BookingInternalNote"("bookingId");
-- CreateIndex
CREATE UNIQUE INDEX "BookingInternalNote_bookingId_notePresetId_key" ON "BookingInternalNote"("bookingId", "notePresetId");
-- CreateIndex
CREATE INDEX "Impersonations_impersonatedUserId_idx" ON "Impersonations"("impersonatedUserId");
-- CreateIndex
CREATE INDEX "Impersonations_impersonatedById_idx" ON "Impersonations"("impersonatedById");
-- AddForeignKey
ALTER TABLE "InternalNotePreset" ADD CONSTRAINT "InternalNotePreset_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BookingInternalNote" ADD CONSTRAINT "BookingInternalNote_notePresetId_fkey" FOREIGN KEY ("notePresetId") REFERENCES "InternalNotePreset"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BookingInternalNote" ADD CONSTRAINT "BookingInternalNote_bookingId_fkey" FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "BookingInternalNote" ADD CONSTRAINT "BookingInternalNote_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;