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: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ IDV_DOMAIN=account.hackclub.com
IDV_CLIENT_ID=changeme
IDV_CLIENT_SECRET=changeme

SENTRY_AUTH_TOKEN=changeme
SENTRY_AUTH_TOKEN=changeme

AI_API_KEY=sk-...
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ You can also run this to get a GUI for the database:
npm run db:studio
```

### AI prereview (devlogs)

- The review panel now shows an AI pre-check on shipped projects’ devlogs. It only flags obvious over-reporting of time.
- Set `AI_API_KEY` to your Hack Club AI API key. No key = no AI hints in review.

## Deploying

Create a `.env` file containing all the required credentials, look at `.env.example` for an example.
Expand Down
1 change: 1 addition & 0 deletions drizzle/0004_huge_clea.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "user" ADD COLUMN "isPrinter" boolean DEFAULT false NOT NULL;
28 changes: 28 additions & 0 deletions drizzle/0004_milky_iron_patriot.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CREATE TABLE "ai_devlog_review" (
"id" serial PRIMARY KEY NOT NULL,
"devlogId" integer NOT NULL,
"projectId" integer NOT NULL,
"approved" boolean NOT NULL,
"rationale" text NOT NULL,
"prompt" text NOT NULL,
"model" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "ai_devlog_review_devlogId_unique" UNIQUE("devlogId")
);
--> statement-breakpoint
CREATE TABLE "ai_project_review" (
"id" serial PRIMARY KEY NOT NULL,
"projectId" integer NOT NULL,
"overallApproved" boolean NOT NULL,
"summary" text NOT NULL,
"prompt" text NOT NULL,
"model" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "ai_project_review_projectId_unique" UNIQUE("projectId")
);
--> statement-breakpoint
ALTER TABLE "ai_devlog_review" ADD CONSTRAINT "ai_devlog_review_devlogId_devlog_id_fk" FOREIGN KEY ("devlogId") REFERENCES "public"."devlog"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ai_devlog_review" ADD CONSTRAINT "ai_devlog_review_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ai_project_review" ADD CONSTRAINT "ai_project_review_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE no action ON UPDATE no action;
Comment on lines +1 to +28
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a discrepancy between migration files 0004_milky_iron_patriot.sql and 0010_swift_korg.sql. The former uses ON DELETE cascade for foreign keys while the latter uses ON DELETE no action. Since 0010 appears to be the final/correct migration that should be run, this inconsistency suggests 0004_milky_iron_patriot.sql is an outdated duplicate that should be removed to avoid confusion.

Suggested change
CREATE TABLE "ai_devlog_review" (
"id" serial PRIMARY KEY NOT NULL,
"devlogId" integer NOT NULL,
"projectId" integer NOT NULL,
"approved" boolean NOT NULL,
"rationale" text NOT NULL,
"prompt" text NOT NULL,
"model" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "ai_devlog_review_devlogId_unique" UNIQUE("devlogId")
);
--> statement-breakpoint
CREATE TABLE "ai_project_review" (
"id" serial PRIMARY KEY NOT NULL,
"projectId" integer NOT NULL,
"overallApproved" boolean NOT NULL,
"summary" text NOT NULL,
"prompt" text NOT NULL,
"model" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "ai_project_review_projectId_unique" UNIQUE("projectId")
);
--> statement-breakpoint
ALTER TABLE "ai_devlog_review" ADD CONSTRAINT "ai_devlog_review_devlogId_devlog_id_fk" FOREIGN KEY ("devlogId") REFERENCES "public"."devlog"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ai_devlog_review" ADD CONSTRAINT "ai_devlog_review_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ai_project_review" ADD CONSTRAINT "ai_project_review_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE no action ON UPDATE no action;

Copilot uses AI. Check for mistakes.
2 changes: 2 additions & 0 deletions drizzle/0005_good_omega_flight.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "project" ADD COLUMN "printedBy" serial NOT NULL;--> statement-breakpoint
ALTER TABLE "project" ADD CONSTRAINT "project_printedBy_user_id_fk" FOREIGN KEY ("printedBy") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
2 changes: 2 additions & 0 deletions drizzle/0006_omniscient_moondragon.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "project" ALTER COLUMN "printedBy" SET DATA TYPE integer;--> statement-breakpoint
ALTER TABLE "project" ALTER COLUMN "printedBy" DROP NOT NULL;
4 changes: 4 additions & 0 deletions drizzle/0007_early_morph.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TYPE "public"."editor_file_type" AS ENUM('url', 'upload');--> statement-breakpoint
ALTER TABLE "project" ADD COLUMN "editorFileType" "editor_file_type";--> statement-breakpoint
ALTER TABLE "project" ADD COLUMN "editorUrl" text;--> statement-breakpoint
ALTER TABLE "project" ADD COLUMN "uploadedFileUrl" text;
1 change: 1 addition & 0 deletions drizzle/0008_tiny_princess_powerful.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "project" ADD COLUMN "modelFile" text;
14 changes: 14 additions & 0 deletions drizzle/0009_clean_supreme_intelligence.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE "ship" (
"id" serial PRIMARY KEY NOT NULL,
"userId" integer NOT NULL,
"projectId" integer NOT NULL,
"url" text NOT NULL,
"editorFileType" "editor_file_type" NOT NULL,
"editorUrl" text,
"uploadedFileUrl" text,
"modelFile" text NOT NULL,
"timestamp" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "ship" ADD CONSTRAINT "ship_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ship" ADD CONSTRAINT "ship_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE no action ON UPDATE no action;
28 changes: 28 additions & 0 deletions drizzle/0010_swift_korg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
CREATE TABLE "ai_devlog_review" (
"id" serial PRIMARY KEY NOT NULL,
"devlogId" integer NOT NULL,
"projectId" integer NOT NULL,
"approved" boolean NOT NULL,
"rationale" text NOT NULL,
"prompt" text NOT NULL,
"model" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "ai_devlog_review_devlogId_unique" UNIQUE("devlogId")
);
--> statement-breakpoint
CREATE TABLE "ai_project_review" (
"id" serial PRIMARY KEY NOT NULL,
"projectId" integer NOT NULL,
"overallApproved" boolean NOT NULL,
"summary" text NOT NULL,
"prompt" text NOT NULL,
"model" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"updatedAt" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "ai_project_review_projectId_unique" UNIQUE("projectId")
);
--> statement-breakpoint
ALTER TABLE "ai_devlog_review" ADD CONSTRAINT "ai_devlog_review_devlogId_devlog_id_fk" FOREIGN KEY ("devlogId") REFERENCES "public"."devlog"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ai_devlog_review" ADD CONSTRAINT "ai_devlog_review_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "ai_project_review" ADD CONSTRAINT "ai_project_review_projectId_project_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."project"("id") ON DELETE no action ON UPDATE no action;
Loading