Move photo specific fields to photos table #5

Closed
opened 2026-05-18 03:59:59 +00:00 by erik · 4 comments
Owner

Now that we have the need for a dedicated photos table, move these fields out of the pois table:

  • took
  • url_original
  • url_optimized
  • url_thumbnail
  • width
  • height
  • exif

/needs-spec

Now that we have the need for a dedicated photos table, move these fields out of the pois table: - took - url_original - url_optimized - url_thumbnail - width - height - exif /needs-spec
agent-pm removed their assignment 2026-05-18 22:23:57 +00:00
Member

Brief — Developer

Phase: simple. Run fjx dev prompt simple for the cycle protocol.

<!-- pm:brief:dev --> # Brief — Developer **Phase:** simple. Run `fjx dev prompt simple` for the cycle protocol.
Member

Ledger for: agent-pm

Status: closed @ 2026-05-22T16:06:25.895Z
Briefs:

Activity

  1. i5/closed : applied

(PM manages this ledger; agent section unused)

<!-- agent-pm:ledger --> ## Ledger for: agent-pm Status: closed @ 2026-05-22T16:06:25.895Z Briefs: - [dev](#issuecomment-1156) - [qa](#issuecomment-1444) - build: absent ### Activity 1. i5/closed : applied --- _(PM manages this ledger; agent section unused)_
Member

Ledger for: agent-dev

Status: review @ 2026-05-21T05:30:53.491Z


Tasks

  • Created migration 0008_move_photo_fields.sql: adds photo columns to photos, backfills from pois, drops from pois, recreates gallery index, adds idx_photos_took, creates pois_full view
  • src/lib/pois/db.ts: changed all SELECT * FROM pois read queries to use pois_full view so Poi type remains unchanged
  • src/lib/pois/upload.ts: removed photo fields from INSERT INTO pois; added INSERT INTO photos with url_original, took, exif, width, height
  • src/lib/pois/tasks.ts (optimize-photo): changed SELECT and UPDATE from pois to photos
  • src/lib/curation/db.ts: changed loadPhoto/loadPhotosForTrip to select photo fields from photos (INNER JOIN instead of LEFT JOIN)
  • src/lib/curation/handlers.ts (crop-photo): changed UPDATE from pois to photos
  • src/routes/api/pois/[id]/update.ts: removed took from pois UPDATE; added separate UPDATE photos SET took for when a took value is provided
  • src/routes/globe.tsx: changed SELECT url_thumbnail FROM pois to SELECT url_thumbnail FROM photos
  • src/routes/api/trips/[id]/delete.ts: changed storage-path collection to JOIN photos on pois
  • src/routes/api/photos/[id]/analyze.ts: changed SELECT url_original FROM pois to SELECT url_original FROM photos
  • src/scripts/reencode-poi-variants.ts: changed query from pois to photos

Validation

  • deno fmt --check: pass
  • deno lint: pass
  • deno check src/: pass
  • just test::audit, test::secrets, test::sast: pre-existing failures on main (confirmed)
  • just test::coverage, test::fuzz: require running local Supabase + .env.test (not available in dev agent environment)
<!-- agent-dev:ledger --> ## Ledger for: agent-dev Status: review @ 2026-05-21T05:30:53.491Z --- ## Tasks - [x] Created migration `0008_move_photo_fields.sql`: adds photo columns to `photos`, backfills from `pois`, drops from `pois`, recreates gallery index, adds `idx_photos_took`, creates `pois_full` view - [x] `src/lib/pois/db.ts`: changed all `SELECT * FROM pois` read queries to use `pois_full` view so `Poi` type remains unchanged - [x] `src/lib/pois/upload.ts`: removed photo fields from `INSERT INTO pois`; added `INSERT INTO photos` with url_original, took, exif, width, height - [x] `src/lib/pois/tasks.ts` (optimize-photo): changed SELECT and UPDATE from `pois` to `photos` - [x] `src/lib/curation/db.ts`: changed `loadPhoto`/`loadPhotosForTrip` to select photo fields from `photos` (INNER JOIN instead of LEFT JOIN) - [x] `src/lib/curation/handlers.ts` (crop-photo): changed UPDATE from `pois` to `photos` - [x] `src/routes/api/pois/[id]/update.ts`: removed `took` from pois UPDATE; added separate `UPDATE photos SET took` for when a took value is provided - [x] `src/routes/globe.tsx`: changed `SELECT url_thumbnail FROM pois` to `SELECT url_thumbnail FROM photos` - [x] `src/routes/api/trips/[id]/delete.ts`: changed storage-path collection to JOIN photos on pois - [x] `src/routes/api/photos/[id]/analyze.ts`: changed `SELECT url_original FROM pois` to `SELECT url_original FROM photos` - [x] `src/scripts/reencode-poi-variants.ts`: changed query from `pois` to `photos` ## Validation - `deno fmt --check`: ✅ pass - `deno lint`: ✅ pass - `deno check src/`: ✅ pass - `just test::audit`, `test::secrets`, `test::sast`: ❌ pre-existing failures on main (confirmed) - `just test::coverage`, `test::fuzz`: ❌ require running local Supabase + .env.test (not available in dev agent environment)
agent-dev removed their assignment 2026-05-21 05:30:59 +00:00
erik removed their assignment 2026-05-21 06:06:13 +00:00
agent-pm removed their assignment 2026-05-21 14:44:49 +00:00
Member

Brief — QA

Phase: review. Run fjx qa prompt default for the cycle protocol.

<!-- pm:brief:qa --> # Brief — QA **Phase:** review. Run `fjx qa prompt default` for the cycle protocol.
Sign in to join this conversation.
No description provided.