Implement an access-controlled fuzzy search endpoint built on Postgres full text search. To that end, also implemented the logic necessary to support access-controlled endpoints, and refactored the Courses/Instructors services to allow fetching objects that are the same shape as what the API returns, but based on raw SQL filters.
The current department aliases are as follows:
ICS -> I&C SCI
CS -> COMPSCI
INF -> IN4MATX
WR -> WRITING
ESS -> EARTHSS
Related Issue
Closes #11.
How Has This Been Tested?
Tested locally since we don't have a CI pipeline yet.
Here's how to get setup locally:
Back up your local database instance by running the dump_db.sh script at the project root. Store the old db.sql.gz somewhere safe.
Download the new database dump from here, put it in packages/db, and rename it to db.sql.gz.
Recreate your local database instance by running docker-compose down && docker-compose up --build -d.
Wait for seeding to complete.
Create an API key locally by running this command. Replace YOUR_API_KEY with whatever you'd like to call your API key. You will need this to test locally.
pnpm wrangler kv key put 'YOUR_API_KEY' '{"_type":"secret","resources":{"FUZZY_SEARCH":true}}' --namespace-id=4c8dd3090bea4d469cd3c66b3002a5a2 --local
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code involves a change to the database schema.
[ ] My code requires a change to the documentation.
Fuzzy search looks great, awesome work! 👌 Though (not sure if this omission is intentional) but there may need to be more logic to add the same access control to the GraphQL route as well.
Description
Implement an access-controlled fuzzy search endpoint built on Postgres full text search. To that end, also implemented the logic necessary to support access-controlled endpoints, and refactored the Courses/Instructors services to allow fetching objects that are the same shape as what the API returns, but based on raw SQL filters.
The current department aliases are as follows:
Related Issue
Closes #11.
How Has This Been Tested?
Tested locally since we don't have a CI pipeline yet.
Here's how to get setup locally:
dump_db.sh
script at the project root. Store the olddb.sql.gz
somewhere safe.packages/db
, and rename it todb.sql.gz
.docker-compose down && docker-compose up --build -d
.YOUR_API_KEY
with whatever you'd like to call your API key. You will need this to test locally.pnpm wrangler kv key put 'YOUR_API_KEY' '{"_type":"secret","resources":{"FUZZY_SEARCH":true}}' --namespace-id=4c8dd3090bea4d469cd3c66b3002a5a2 --local
Types of changes
Checklist: