Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Guest Mode Support #31

Open
wants to merge 3 commits into
base: vlad/remove-merge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: '3.8'

services:
app:
platform: linux/arm64/v8
build:
context: .
target: development
Expand Down Expand Up @@ -39,8 +38,7 @@ services:
- redis

db:
platform: linux/arm64/v8
image: postgres:16
image: postgres:latest
ports:
- "5432:5432"
environment:
Expand All @@ -60,8 +58,7 @@ services:
retries: 5

redis:
platform: linux/arm64/v8
image: redis:7
image: redis:latest
ports:
- "6379:6379"
volumes:
Expand All @@ -79,7 +76,6 @@ services:

redis-insight:
image: redislabs/redisinsight:latest
platform: linux/arm64/v8 # For M1/M2 Macs
ports:
- "8001:8001"
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
Expand All @@ -25,6 +26,7 @@
"googleapis": "^144.0.0",
"ioredis": "^5.4.2",
"lucide-react": "^0.309.0",
"nanoid": "^5.1.0",
"next": "14.1.0",
"next-auth": "^4.24.11",
"next-themes": "^0.2.1",
Expand Down
74 changes: 74 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions prisma/migrations/20250219004029_add_usage_model/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
-- CreateEnum
CREATE TYPE "UsageType" AS ENUM ('AUDIO_GENERATION', 'DOCUMENT_PROCESSING', 'CONTEXT_TOKENS');

-- AlterTable
ALTER TABLE "User" ADD COLUMN "credits" INTEGER NOT NULL DEFAULT 100,
ADD COLUMN "isGuest" BOOLEAN NOT NULL DEFAULT false,
ALTER COLUMN "clerkId" DROP NOT NULL;

-- AlterTable
ALTER TABLE "_BookmarkedNotebooks" ADD CONSTRAINT "_BookmarkedNotebooks_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_BookmarkedNotebooks_AB_unique";

-- AlterTable
ALTER TABLE "_NoteToTag" ADD CONSTRAINT "_NoteToTag_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_NoteToTag_AB_unique";

-- AlterTable
ALTER TABLE "_NotebookToTag" ADD CONSTRAINT "_NotebookToTag_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_NotebookToTag_AB_unique";

-- AlterTable
ALTER TABLE "_SharedNotebooks" ADD CONSTRAINT "_SharedNotebooks_AB_pkey" PRIMARY KEY ("A", "B");

-- DropIndex
DROP INDEX "_SharedNotebooks_AB_unique";

-- CreateTable
CREATE TABLE "CreditHistory" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"amount" INTEGER NOT NULL,
"operation" TEXT NOT NULL,
"description" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

CONSTRAINT "CreditHistory_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Usage" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"type" "UsageType" NOT NULL,
"amount" INTEGER NOT NULL,
"notebookId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

CONSTRAINT "Usage_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "CreditHistory_userId_idx" ON "CreditHistory"("userId");

-- CreateIndex
CREATE INDEX "Usage_userId_idx" ON "Usage"("userId");

-- CreateIndex
CREATE INDEX "Usage_type_idx" ON "Usage"("type");

-- AddForeignKey
ALTER TABLE "CreditHistory" ADD CONSTRAINT "CreditHistory_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Usage" ADD CONSTRAINT "Usage_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
2 changes: 1 addition & 1 deletion prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
Loading
Loading