Skip to content
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ MOBILE_REDIRECT_URI=devcard://oauth/callback
# ─── Server ───
PORT=3000
NODE_ENV=development

# ─── AI (optional β€” enables AI-generated developer summaries) ───
# Get a free key at https://aistudio.google.com/app/apikey
GEMINI_API_KEY=
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "github_insights_cache" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"payload" JSONB NOT NULL,
"expires_at" TIMESTAMP(3) NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "github_insights_cache_user_id_key" ON "github_insights_cache"("user_id");

-- AddForeignKey
ALTER TABLE "github_insights_cache" ADD CONSTRAINT "github_insights_cache_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
14 changes: 14 additions & 0 deletions apps/backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ model User {
ownedViews CardView[] @relation("cardOwner")
viewedCards CardView[] @relation("cardViewer")
followLogs FollowLog[]
githubInsightsCache GitHubInsightsCache?

@@unique([provider, providerId])
@@map("users")
Expand Down Expand Up @@ -124,3 +125,16 @@ model FollowLog {

@@map("follow_logs")
}

model GitHubInsightsCache {
id String @id @default(uuid())
userId String @unique @map("user_id")
payload Json // serialized GitHubInsights
expiresAt DateTime @map("expires_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@map("github_insights_cache")
}
Loading