Skip to content

Commit 5f41a02

Browse files
authored
Merge pull request #127 from hackclub/clubsupport
Add Club Integration
2 parents bc6eb83 + cc6b4a8 commit 5f41a02

13 files changed

Lines changed: 2411 additions & 325 deletions

File tree

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ SENTRY_AUTH_TOKEN=changeme
3434

3535
# AIRTABLE_TOKEN=abcxyz # optional
3636

37-
PRINTABLES_ALLOWED_LICENSES_ID=7,1,2,9,12,10,11 # License IDs from printables
37+
PRINTABLES_ALLOWED_LICENSES_ID=7,1,2,9,12,10,11 # License IDs from printables
38+
39+
CLUBS_API_KEY=changeme # API key for clubs.hackclub.com
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CREATE TYPE "public"."club_role" AS ENUM('leader', 'member');--> statement-breakpoint
2+
CREATE TABLE "club" (
3+
"id" serial PRIMARY KEY NOT NULL,
4+
"name" text NOT NULL,
5+
"joinCode" text,
6+
"createdAt" timestamp DEFAULT now(),
7+
CONSTRAINT "club_name_unique" UNIQUE("name")
8+
);
9+
--> statement-breakpoint
10+
CREATE TABLE "club_membership" (
11+
"id" serial PRIMARY KEY NOT NULL,
12+
"clubId" integer NOT NULL,
13+
"userId" integer NOT NULL,
14+
"role" "club_role" NOT NULL,
15+
"createdAt" timestamp DEFAULT now(),
16+
CONSTRAINT "club_membership_userId_unique" UNIQUE("userId")
17+
);
18+
--> statement-breakpoint
19+
ALTER TABLE "ship" ADD COLUMN "clubId" integer;--> statement-breakpoint
20+
ALTER TABLE "club_membership" ADD CONSTRAINT "club_membership_clubId_club_id_fk" FOREIGN KEY ("clubId") REFERENCES "public"."club"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
21+
ALTER TABLE "club_membership" ADD CONSTRAINT "club_membership_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
22+
ALTER TABLE "ship" ADD CONSTRAINT "ship_clubId_club_id_fk" FOREIGN KEY ("clubId") REFERENCES "public"."club"("id") ON DELETE no action ON UPDATE no action;

0 commit comments

Comments
 (0)