Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e9ff386
feat: capital grains override
cirex-web Aug 22, 2025
1e4c2d0
chore: remove console.log
cirex-web Aug 22, 2025
9ad006d
fix: fix existing tests
cirex-web Aug 22, 2025
54fd9b2
tests: add tests for overwrites
cirex-web Aug 23, 2025
56b33b7
fix: notify when response date header becomes unparseable
cirex-web Aug 23, 2025
ee2dafb
Merge branch 'staging' of https://github.com/ScottyLabs/dining-api in…
cirex-web Aug 23, 2025
e2e18ec
refactor: rework the entire parsing algorithm to better accomodate ti…
cirex-web Sep 5, 2025
b1ea9a9
chore: update time slot overwrite description
cirex-web Sep 5, 2025
c196e80
Merge branch 'staging' into feat/time-overwrites
cirex-web Oct 4, 2025
4821b33
chore: fix cheerio element typechecking
cirex-web Oct 4, 2025
078a5eb
chore: add luxon types
cirex-web Oct 4, 2025
b39a02c
feat: complete database integration with overwriting any field (exclu…
cirex-web Nov 8, 2025
771a107
chore: remove time overwrites file
cirex-web Nov 8, 2025
ca24b72
tests: fix a good number of tests
cirex-web Nov 8, 2025
c8d7722
style: add empty openapi endpoint and pretty-print all json
cirex-web Nov 9, 2025
7f290e2
test: fix all tests
cirex-web Nov 9, 2025
10d12dd
fix: typecheck
cirex-web Nov 9, 2025
eac9ca6
chore: move from jest to vitest
cirex-web Nov 10, 2025
2d06aad
fix: tests
cirex-web Nov 10, 2025
fd00731
tests: add 2 mock db tests
cirex-web Nov 10, 2025
ac79f07
fix: give more startup time for tests
cirex-web Nov 10, 2025
2507234
test: run all tests
cirex-web Nov 10, 2025
cc1c3f6
tests: test on dst times and specials
cirex-web Nov 12, 2025
1bf7b1b
fix: make the 'today' param required for scrape result
cirex-web Nov 13, 2025
c5d45c9
test: parallel tests
cirex-web Nov 13, 2025
07ad8c4
test: run all tests
cirex-web Nov 13, 2025
f8d6878
test: make tests more readable
cirex-web Nov 13, 2025
687ed6f
test: add a few more tests
cirex-web Nov 13, 2025
e93638d
chore: rename variable
cirex-web Nov 13, 2025
4ecf5cb
chore: bundle writes into single transaction and add coverage reporting
cirex-web Nov 13, 2025
7f6d7ef
chore: uncomment reload function
cirex-web Nov 13, 2025
079587d
chore: upd readme
cirex-web Nov 13, 2025
4ac144b
Initial plan
Copilot Nov 13, 2025
76891b8
Refactor timestamps in database.test.ts to use timeToUnixTimestamp fu…
Copilot Nov 13, 2025
fdaa26e
chore: upd readme
cirex-web Nov 22, 2025
9f7901d
chore: add column names to some columns in the schema
cirex-web Nov 22, 2025
85bafd1
chore: remove redundant paren
cirex-web Nov 22, 2025
b9d747c
Merge pull request #213 from ScottyLabs/copilot/sub-pr-195-again
cirex-web Nov 22, 2025
8be7e44
test: add two more tests
cirex-web Nov 22, 2025
d9b38ef
chore: add additional today param check
cirex-web Nov 22, 2025
a40b010
fix: date timezone thing for tests
cirex-web Nov 22, 2025
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 .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: run tests
run: pnpm test
run: pnpm test:coverage
- name: "Report Coverage"
uses: davelosert/vitest-coverage-report-action@v2
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# this is the file that railway will run
FROM node:24-slim AS base
ENV PNPM_HOME="/pnpm"
# ENV PATH="$PNPM_HOME:$PATH"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Now install the API's dependencies by 'cd'-ing into the root of the repository a
pnpm install
```

Start your local database with `pnpm db:start` and then start the server with `pnpm dev` and it should work, assuming you have the correct env variables. (To see the contents of the database, I recommend using DBeaver. You can also run `pnpm db:studio` to start up drizzle studio)
Start your local database with `pnpm db:start`, `pnpm db:push` (if this is your first time) and then start the server with `pnpm dev` and it should work, assuming you have the correct env variables. (To see the contents of the database, I recommend using DBeaver. You can also run `pnpm db:studio` to start up drizzle studio)

## Database schema changes (important!)

When you make changes to the database schema, be sure to run `pnpm db:push` to keep your local db in sync.

Before merging your PR, be sure to run `pnpm db:generate` to generate a migration file, which will then be automatically applied to the staging and production databases when deployed.
Before merging your PR, be sure to run `pnpm db:generate` to generate a migration file, which will then be automatically applied to the staging and production databases when deployed. (You should do this before running tests as well!)

To test if the migration files work, you can run `pnpm run-prod`, which will spin up a production version of the server and a postgres database mounted on a new volume. The server is created using the same Dockerfile used in our Railway deployments, so if it works locally, it (probably) works in production as well.

Expand Down
57 changes: 57 additions & 0 deletions drizzle/0001_broad_lord_tyger.sql
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why is this file named like this lol

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

drizzle auto-names the migration files lol

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
CREATE TYPE "public"."specialType" AS ENUM('special', 'soup');--> statement-breakpoint
CREATE TABLE "concept_id_to_internal_id" (
"internal_id" text NOT NULL,
"external_id" text PRIMARY KEY NOT NULL,
CONSTRAINT "concept_id_to_internal_id_external_id_unique" UNIQUE("external_id")
);
--> statement-breakpoint
CREATE TABLE "location_data" (
"id" text PRIMARY KEY NOT NULL,
"name" text,
"short_description" text,
"description" text NOT NULL,
"url" text NOT NULL,
"menu" text,
"location" text NOT NULL,
"coordinate_lat" numeric,
"coordinate_lng" numeric,
"acceptsOnlineOrders" boolean NOT NULL
);
--> statement-breakpoint
CREATE TABLE "specials" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "specials_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"location_id" text NOT NULL,
"name" text NOT NULL,
"description" text NOT NULL,
"date" date NOT NULL,
"type" "specialType" NOT NULL
);
--> statement-breakpoint
CREATE TABLE "time_overwrites_table" (
"location_id" text NOT NULL,
"date" date NOT NULL,
"time_string" text NOT NULL,
CONSTRAINT "time_overwrites_table_location_id_date_pk" PRIMARY KEY("location_id","date")
);
--> statement-breakpoint
CREATE TABLE "location_times" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "location_times_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"location_id" text NOT NULL,
"date" date NOT NULL,
"start_time" integer NOT NULL,
"end_time" integer NOT NULL
);
--> statement-breakpoint
ALTER TABLE "overwrites_table" RENAME COLUMN "concept_id" TO "location_id";--> statement-breakpoint

-- Manual
ALTER TABLE "overwrites_table" ALTER COLUMN "location_id" TYPE TEXT, ALTER COLUMN "location_id" SET NOT NULL; --> statement-breakpoint
-- Manual

ALTER TABLE "concept_id_to_internal_id" ADD CONSTRAINT "concept_id_to_internal_id_internal_id_location_data_id_fk" FOREIGN KEY ("internal_id") REFERENCES "public"."location_data"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "specials" ADD CONSTRAINT "specials_location_id_location_data_id_fk" FOREIGN KEY ("location_id") REFERENCES "public"."location_data"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "time_overwrites_table" ADD CONSTRAINT "time_overwrites_table_location_id_location_data_id_fk" FOREIGN KEY ("location_id") REFERENCES "public"."location_data"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "location_times" ADD CONSTRAINT "location_times_location_id_location_data_id_fk" FOREIGN KEY ("location_id") REFERENCES "public"."location_data"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "date_lookup" ON "location_times" USING btree ("location_id","date");--> statement-breakpoint
ALTER TABLE "overwrites_table" ADD CONSTRAINT "overwrites_table_location_id_location_data_id_fk" FOREIGN KEY ("location_id") REFERENCES "public"."location_data"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "overwrites_table" DROP COLUMN "times";
3 changes: 3 additions & 0 deletions drizzle/0002_fair_meteorite.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "location_data" RENAME COLUMN "acceptsOnlineOrders" TO "accepts_online_orders";--> statement-breakpoint
ALTER TABLE "overwrites_table" RENAME COLUMN "coordinateLat" TO "coordinate_lat";--> statement-breakpoint
ALTER TABLE "overwrites_table" RENAME COLUMN "coordinateLng" TO "coordinate_lng";
Loading