Skip to content

Commit

Permalink
🚀 initial commit!
Browse files Browse the repository at this point in the history
  • Loading branch information
changesbyjames committed Nov 7, 2024
1 parent f54e443 commit 3e6de38
Show file tree
Hide file tree
Showing 1,489 changed files with 39,141 additions and 3,372 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
**/node_modules
**/**/node_modules
**/dist

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ Thumbs.db

dist/

docker-compose.local.yml
docker-compose.local.yml

Empty file added census/README.md
Empty file.
15 changes: 4 additions & 11 deletions census/api/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
TWITCH_CLIENT_ID=
TWITCH_CLIENT_SECRET=
TWITCH_USERNAME=

REDIS_HOST=localhost
REDIS_PORT=6379
TWITCH_CLIENT_ID=itag8f5m4r3ynbtrz933d7qh7c6ffq
TWITCH_CLIENT_SECRET=exs4bkvzrlvfq6m2n0gez519zzv4a2

HOST=localhost
PORT=35523
Expand All @@ -14,11 +10,8 @@ POSTGRES_DB=db01
POSTGRES_HOST=localhost

UI_URL=http://localhost:5173

JWT_SECRET=bed840003446895cfee9182afad1c9adace070b0b54cdfdc640d61b981b5a5aeb3af9519785d5935b8de0f25469b782701b2276a22df329a971c3065bd59a565
COMMAND_PREFIX=$
CHANNELS_TO_LISTEN_TO=
JWT_SECRET=

STORAGE_ACCOUNT_NAME=
STORAGE_ACCOUNT_KEY=
CONTAINER_NAME=
CONTAINER_NAME=snapshots
2 changes: 1 addition & 1 deletion census/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY . .

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm --filter=@critter/api --prod deploy /prod/api
RUN pnpm --filter=@alveusgg/census-api --prod deploy /prod/api

FROM base
COPY --from=build /prod/api /prod/api
Expand Down
Binary file added census/api/assets/shiny/s1.zip
Binary file not shown.
Binary file added census/api/assets/shiny/s1/1012092.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions census/api/assets/shiny/s1/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"season": 1,
"from": "2024-01-01",
"to": "2024-03-31",
"shiny": [
{
"name": "Shiny",
"iNatId": 1012082,
"image": "1012082.png"
}
]
}
75 changes: 75 additions & 0 deletions census/api/drizzle/0002_third_cloak.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
CREATE TABLE IF NOT EXISTS "achievements" (
"id" serial PRIMARY KEY NOT NULL,
"username" text NOT NULL,
"type" text NOT NULL,
"points" integer NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"revoked" boolean DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "events" (
"id" serial PRIMARY KEY NOT NULL,
"username" text NOT NULL,
"type" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"payload" json NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "notifications" (
"id" serial PRIMARY KEY NOT NULL,
"username" text NOT NULL,
"type" text NOT NULL,
"read" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"payload" json NOT NULL
);
--> statement-breakpoint
ALTER TABLE "roles" RENAME TO "users";--> statement-breakpoint
ALTER TABLE "captures" DROP CONSTRAINT "clip_url_unique_idx";--> statement-breakpoint
ALTER TABLE "identifications" DROP CONSTRAINT "identifications_suggested_by_roles_username_fk";
--> statement-breakpoint
ALTER TABLE "identifications" DROP CONSTRAINT "identifications_confirmed_by_roles_username_fk";
--> statement-breakpoint
ALTER TABLE "captures" ADD COLUMN "clip_id" text NOT NULL;--> statement-breakpoint
ALTER TABLE "captures" ADD COLUMN "clip_metadata" json NOT NULL;--> statement-breakpoint
ALTER TABLE "identifications" ADD COLUMN "accessory_for" integer;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "points" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "achievements" ADD CONSTRAINT "achievements_username_users_username_fk" FOREIGN KEY ("username") REFERENCES "public"."users"("username") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "events" ADD CONSTRAINT "events_username_users_username_fk" FOREIGN KEY ("username") REFERENCES "public"."users"("username") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_username_users_username_fk" FOREIGN KEY ("username") REFERENCES "public"."users"("username") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "username_achievements_idx" ON "achievements" USING btree ("username");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "type_achievements_idx" ON "achievements" USING btree ("type");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "points_achievements_idx" ON "achievements" USING btree ("points");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "username_events_idx" ON "events" USING btree ("username");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "type_events_idx" ON "events" USING btree ("type");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "username_notifications_idx" ON "notifications" USING btree ("username");--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "identifications" ADD CONSTRAINT "identifications_suggested_by_users_username_fk" FOREIGN KEY ("suggested_by") REFERENCES "public"."users"("username") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "identifications" ADD CONSTRAINT "identifications_confirmed_by_users_username_fk" FOREIGN KEY ("confirmed_by") REFERENCES "public"."users"("username") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "clip_id_idx" ON "captures" USING btree ("clip_id");--> statement-breakpoint
ALTER TABLE "captures" DROP COLUMN IF EXISTS "clip_url";--> statement-breakpoint
ALTER TABLE "captures" ADD CONSTRAINT "captures_clip_id_unique" UNIQUE("clip_id");
6 changes: 6 additions & 0 deletions census/api/drizzle/0003_tearful_tusk.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALTER TYPE "capture_status" ADD VALUE 'draft';--> statement-breakpoint
ALTER TABLE "images" RENAME COLUMN "bounding_boxes" TO "bounding_box";--> statement-breakpoint
ALTER TABLE "images" ALTER COLUMN "bounding_box" DROP DEFAULT;--> statement-breakpoint
ALTER TABLE "observations" ALTER COLUMN "nickname" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "observations" ADD COLUMN "removed" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "observations" ADD COLUMN "moderated" json DEFAULT '[]'::json NOT NULL;
1 change: 1 addition & 0 deletions census/api/drizzle/0004_black_preak.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "observations" DROP CONSTRAINT "discord_thread_id_unique_idx";
2 changes: 2 additions & 0 deletions census/api/drizzle/0005_gigantic_edwin_jarvis.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "images" ADD COLUMN "width" integer NOT NULL;--> statement-breakpoint
ALTER TABLE "images" ADD COLUMN "height" integer NOT NULL;
1 change: 1 addition & 0 deletions census/api/drizzle/0006_regular_wiccan.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "images" RENAME COLUMN "frame" TO "timestamp";
1 change: 1 addition & 0 deletions census/api/drizzle/0007_stale_albert_cleary.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "images" ALTER COLUMN "timestamp" SET DATA TYPE numeric;
1 change: 1 addition & 0 deletions census/api/drizzle/0008_aromatic_kree.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "achievements" ADD COLUMN "redeemed" boolean DEFAULT false NOT NULL;
13 changes: 13 additions & 0 deletions census/api/drizzle/0009_thin_carnage.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ALTER TABLE "achievements" ADD COLUMN "identification_id" integer;--> statement-breakpoint
ALTER TABLE "achievements" ADD COLUMN "observation_id" integer;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "achievements" ADD CONSTRAINT "achievements_identification_id_identifications_id_fk" FOREIGN KEY ("identification_id") REFERENCES "public"."identifications"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "achievements" ADD CONSTRAINT "achievements_observation_id_observations_id_fk" FOREIGN KEY ("observation_id") REFERENCES "public"."observations"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
7 changes: 7 additions & 0 deletions census/api/drizzle/0010_dazzling_green_goblin.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE "observations" ADD COLUMN "observed_at" timestamp NOT NULL;--> statement-breakpoint
ALTER TABLE "observations" ADD COLUMN "observed_by" text NOT NULL;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "observations" ADD CONSTRAINT "observations_observed_by_users_username_fk" FOREIGN KEY ("observed_by") REFERENCES "public"."users"("username") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading

0 comments on commit 3e6de38

Please sign in to comment.