mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* feat: report booking * refactor: improvements * test: add unit test * test: add unit test * chore * refactor: feedback * refactor: feedback * refactor: feedback * fix: use string * fix: schema * chore: improvements * refactor: create service * fix: udate test * fix: feedback * fix: schema * fix: type * fix: type * refactor: address feedback * refactor: move to new file * refactor: move to new file * chor: remove * fix UserRepository import * fix type of bookingUid * fix: import path * fix: remove cancellation * chore: duplicate * fix: tests * refactor: feedback * chore: remove table from here * fix: types * fix: types --------- Co-authored-by: CarinaWolli <[email protected]>
50 lines
1.9 KiB
SQL
50 lines
1.9 KiB
SQL
-- CreateEnum
|
|
CREATE TYPE "BookingReportReason" AS ENUM ('SPAM', 'dont_know_person', 'OTHER');
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "BookingReport" (
|
|
"id" UUID NOT NULL,
|
|
"bookingUid" TEXT NOT NULL,
|
|
"bookerEmail" TEXT NOT NULL,
|
|
"reportedById" INTEGER,
|
|
"organizationId" INTEGER,
|
|
"reason" "BookingReportReason" NOT NULL,
|
|
"description" TEXT,
|
|
"cancelled" BOOLEAN NOT NULL DEFAULT false,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
"watchlistId" UUID,
|
|
|
|
CONSTRAINT "BookingReport_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "BookingReport_bookingUid_key" ON "BookingReport"("bookingUid");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "BookingReport_bookerEmail_idx" ON "BookingReport"("bookerEmail");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "BookingReport_reportedById_idx" ON "BookingReport"("reportedById");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "BookingReport_organizationId_idx" ON "BookingReport"("organizationId");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "BookingReport_watchlistId_idx" ON "BookingReport"("watchlistId");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "BookingReport_createdAt_idx" ON "BookingReport"("createdAt");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "BookingReport" ADD CONSTRAINT "BookingReport_bookingUid_fkey" FOREIGN KEY ("bookingUid") REFERENCES "Booking"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "BookingReport" ADD CONSTRAINT "BookingReport_reportedById_fkey" FOREIGN KEY ("reportedById") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "BookingReport" ADD CONSTRAINT "BookingReport_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Team"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "BookingReport" ADD CONSTRAINT "BookingReport_watchlistId_fkey" FOREIGN KEY ("watchlistId") REFERENCES "Watchlist"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|