Feature/adc/#50 users settings route (#89)
* #50 - migration 20221023123919_ + route settings * #50 - migration 20221023123919_ + route settings * #50 - settings creation at user creation + update migration * changed settings acces from by id to userId * deleting the user results in deleting it's associated userSettings row * pr fixes + robot tests + other minor fixes * removed useless comments * added settings endpoint to /auth/me and automated creation to /register * clean code before merge
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "UserSettings" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"userId" INTEGER NOT NULL,
|
||||
"pushNotification" BOOLEAN NOT NULL DEFAULT true,
|
||||
"emailNotification" BOOLEAN NOT NULL DEFAULT true,
|
||||
"trainingNotification" BOOLEAN NOT NULL DEFAULT true,
|
||||
"newsongNotification" BOOLEAN NOT NULL DEFAULT true,
|
||||
"dataCollection" BOOLEAN NOT NULL DEFAULT true,
|
||||
"CustomAdds" BOOLEAN NOT NULL DEFAULT true,
|
||||
"Recommendations" BOOLEAN NOT NULL DEFAULT true,
|
||||
|
||||
CONSTRAINT "UserSettings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "UserSettings_userId_key" ON "UserSettings"("userId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserSettings" ADD CONSTRAINT "UserSettings_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `CustomAdds` on the `UserSettings` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `Recommendations` on the `UserSettings` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `dataCollection` on the `UserSettings` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `newsongNotification` on the `UserSettings` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "UserSettings" DROP CONSTRAINT "UserSettings_userId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "UserSettings" DROP COLUMN "CustomAdds",
|
||||
DROP COLUMN "Recommendations",
|
||||
DROP COLUMN "dataCollection",
|
||||
DROP COLUMN "newsongNotification",
|
||||
ADD COLUMN "leaderBoard" BOOLEAN NOT NULL DEFAULT true,
|
||||
ADD COLUMN "newSongNotification" BOOLEAN NOT NULL DEFAULT true,
|
||||
ADD COLUMN "recommendations" BOOLEAN NOT NULL DEFAULT true,
|
||||
ADD COLUMN "showActivity" BOOLEAN NOT NULL DEFAULT true,
|
||||
ADD COLUMN "weeklyReport" BOOLEAN NOT NULL DEFAULT true;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "UserSettings" ADD CONSTRAINT "UserSettings_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user