feat(backend): supabase hackathons table, RLS read policy, and seed#67
Open
henryng15 wants to merge 4 commits into
Open
feat(backend): supabase hackathons table, RLS read policy, and seed#67henryng15 wants to merge 4 commits into
henryng15 wants to merge 4 commits into
Conversation
Root .gitignore did not cover .env, so a key pasted anywhere outside web/ would have been tracked. Negate .env.example so templates stay committed.
Anon key only. Flags the service key as never belonging here.
Maps company_name to host and upserts on the id primary key with Prefer: resolution=merge-duplicates, so re-runs are idempotent. Carries deadline and featured, which listings.json gained after issue #11 was written; the table needs both columns added. Geo columns are left unset for the geocoder in #12. build_row and upsert are importable so the sync Action in #13 does not reimplement the mapping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
Stands up the Supabase
hackathonsread replica that the globe reads from, plus the one-off seed that proves the shape works. The table itself is dashboard state; this PR carries the mapping code, the tests, and the env hygiene that goes with it.Acceptance
selectvisible rows, anon cannot writeSUPABASE_URL+SUPABASE_SERVICE_KEYadded as repo secretsSchema deviation — please read before #13
listings.jsongained two fields after this issue was written, and the issue's DDL has no columns for them:deadline(ISO date) — from the deadline watcher, [Enhancement] Scheduled deadline watcher for existing listings #54. Present on 21 of 32 listings.featured(bool) — from the favorites feature, Feature: "Favorites" — flag + filter to pin the best-of-the-best hackathons #21/Add a "favorites" field to highlight curated picks #25. Present on 3.Seeding against the literal DDL would have made PostgREST reject the payload, and the workaround would have been to silently drop both fields — which is exactly the data #17's detail card and #18's filters will want. So the table has two extra columns:
deadlineisdate, nottext, so #18 can do range queries.@vickmahi — write #13's sync against this shape, not the DDL in the issue body.
build_row()andupsert()inseed_supabase.pyare importable for exactly that reason; please reuse them rather than reimplementing thecompany_name→hostmapping.Verification
RLS was checked against the live project with the anon key:
selecton visible rows →200,content-range: 0-31/32insert→401,42501: new row violates row-level security policy, no row writtenRLS is default-deny and
public readis the only policy, soupdate/deleteare refused for the same reason. All 32 rows havelat/lng/geo_statusnull, waiting on the geocoder in #12.Notes
idprimary key withPrefer: resolution=merge-duplicates. Re-running does not duplicate..gitignoredid not cover.env. Onlyweb/.gitignoredid, so a key pasted anywhere else in the repo would have been tracked. Fixed here.site/.env.examplelands early because the anon key had to go somewhere documented. Frontend: Scaffold Vite + React + TS + Tailwind app (site/) #14 owns the rest ofsite/.