fix: tidy code and update endpoints

This commit is contained in:
Mythie
2023-09-21 00:51:02 +00:00
parent 8df5304b8e
commit 15fd819132
19 changed files with 365 additions and 154 deletions

View File

@ -0,0 +1,35 @@
/*
Warnings:
- You are about to drop the `Share` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Share" DROP CONSTRAINT "Share_documentId_fkey";
-- DropForeignKey
ALTER TABLE "Share" DROP CONSTRAINT "Share_recipientId_fkey";
-- DropTable
DROP TABLE "Share";
-- CreateTable
CREATE TABLE "DocumentShareLink" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"slug" TEXT NOT NULL,
"documentId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "DocumentShareLink_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "DocumentShareLink_slug_key" ON "DocumentShareLink"("slug");
-- CreateIndex
CREATE UNIQUE INDEX "DocumentShareLink_documentId_email_key" ON "DocumentShareLink"("documentId", "email");
-- AddForeignKey
ALTER TABLE "DocumentShareLink" ADD CONSTRAINT "DocumentShareLink_documentId_fkey" FOREIGN KEY ("documentId") REFERENCES "Document"("id") ON DELETE RESTRICT ON UPDATE CASCADE;