feat(gif-mood): hide/reveal GIFs from other participants

- Add hidden field to GifMoodUserRating (schema + migration)
- Add setGifMoodUserHidden service + action with SSE broadcast
- Current user sees Cacher/Révéler toggle in their section header
- Other users see a locked placeholder with item count when hidden

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 16:35:43 +01:00
parent ab00627a09
commit e7ce98320d
5 changed files with 135 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_GifMoodUserRating" (
"id" TEXT NOT NULL PRIMARY KEY,
"sessionId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"rating" INTEGER,
"hidden" BOOLEAN NOT NULL DEFAULT false,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GifMoodUserRating_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "GifMoodSession" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "GifMoodUserRating_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_GifMoodUserRating" ("createdAt", "id", "rating", "sessionId", "updatedAt", "userId") SELECT "createdAt", "id", "rating", "sessionId", "updatedAt", "userId" FROM "GifMoodUserRating";
DROP TABLE "GifMoodUserRating";
ALTER TABLE "new_GifMoodUserRating" RENAME TO "GifMoodUserRating";
CREATE INDEX "GifMoodUserRating_sessionId_idx" ON "GifMoodUserRating"("sessionId");
CREATE UNIQUE INDEX "GifMoodUserRating_sessionId_userId_key" ON "GifMoodUserRating"("sessionId", "userId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;