Add proclamations api endpoint

This commit is contained in:
NeilClack
2026-03-18 01:09:21 -05:00
parent 791114d2aa
commit 56c688f674
17 changed files with 2044 additions and 126 deletions
@@ -0,0 +1,2 @@
-- DropIndex
DROP INDEX "Proclamation_content_key";
@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[key]` on the table `LicenseKey` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "LicenseKey_key_key" ON "LicenseKey"("key");
@@ -0,0 +1,15 @@
-- CreateTable
CREATE TABLE "UserProclamations" (
"userId" TEXT NOT NULL,
"proclamationId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "UserProclamations_pkey" PRIMARY KEY ("userId","proclamationId")
);
-- AddForeignKey
ALTER TABLE "UserProclamations" ADD CONSTRAINT "UserProclamations_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserProclamations" ADD CONSTRAINT "UserProclamations_proclamationId_fkey" FOREIGN KEY ("proclamationId") REFERENCES "Proclamation"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+27 -14
View File
@@ -14,19 +14,20 @@ datasource db {
}
model User {
id String @id
name String
email String
emailVerified Boolean @default(false)
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
roleId Int?
role UserRole? @relation(fields: [roleId], references: [id])
sessions Session[]
accounts Account[]
profile Profile?
licenseKeys LicenseKey[]
id String @id
name String
email String
emailVerified Boolean @default(false)
image String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
roleId Int?
role UserRole? @relation(fields: [roleId], references: [id])
sessions Session[]
accounts Account[]
profile Profile?
licenseKeys LicenseKey[]
userProclamations UserProclamations[]
@@unique([email])
@@map("user")
@@ -118,6 +119,18 @@ model Proclamation {
categoryId Int
category ProclamationCategory @relation(fields: [categoryId], references: [id])
price Float @default(0.99)
userProclamations UserProclamations[]
}
model UserProclamations {
userId String
user User @relation(fields: [userId], references: [id])
proclamationId String
proclamation Proclamation @relation(fields: [proclamationId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@id([userId, proclamationId])
}
model SolfeggioFrequency {
@@ -140,7 +153,7 @@ model ProclamationCategory {
model LicenseKey {
id String @id @default(uuid())
key String
key String @unique
active Boolean
level String
userId String