Skip to content

feat: add chronology field to tv shows (closes #32)#35

Merged
AugustoMarcelo merged 1 commit intomasterfrom
feat/tvshows-chronology
Apr 10, 2026
Merged

feat: add chronology field to tv shows (closes #32)#35
AugustoMarcelo merged 1 commit intomasterfrom
feat/tvshows-chronology

Conversation

@AugustoMarcelo
Copy link
Copy Markdown
Owner

@AugustoMarcelo AugustoMarcelo commented Apr 10, 2026

Summary

  • Adds a nullable chronology integer column to tvshows, mirroring movies.chronology, so clients can sort/filter /tvshows numerically and merge with /movies for a unified chronological view of all MCU projects (issue Suggestion: Chronology for shows #32).
  • New migration 1776153600000-AddChronologyToTVShows adds the column with a symmetric down() that drops it.
  • TVShowsRepository.findAll now treats chronology as a numeric column for the ?filter= path, so ?filter=chronology=5 matches as an integer rather than an ILIKE pattern.
  • Seed factory (src/shared/infra/typeorm/factories/tvshows.factory.ts) populates each of the 19 shows with a chronology value.

⚠️ Data values need review

The chronology values assigned to the 19 shows in the factory (4159, in id order) are placeholders. They let the plumbing work and the PR be merged safely, but they stack all shows after the existing movies (which run 140) rather than interleaving them with the correct in-universe ordering (e.g. WandaVision sits right after Avengers: Endgame).

Before merging, please re-number these to the canonical MCU in-universe order — either by renumbering shows to fit between movie values, or by renumbering both movies and shows onto a shared scale with gaps. No code changes are needed for that, only factory data.

Test plan

  • npm run test — 6 suites / 13 tests green, 100% coverage on affected modules
  • npx tsc --noEmit — clean
  • Run migration locally against postgres: npm run typeorm:dev migration:run, inspect tvshows schema
  • Verify down(): npm run typeorm:dev migration:revert
  • GET /tvshows?order=chronology,asc returns shows sorted ascending
  • GET /tvshows?filter=chronology=41 returns only WandaVision (exercises the numeric-column filter branch)
  • GET /tvshows?columns=title,chronology returns only those two columns

Closes #32

🤖 Generated with Claude Code

Mirrors the existing movies.chronology property so clients can
sort/filter /tvshows numerically and merge the result with /movies
for a unified chronological ordering of MCU projects.

Closes #32

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AugustoMarcelo
Copy link
Copy Markdown
Owner Author

Verified end-to-end against a local postgres 16 container.

Migration

query: ALTER TABLE "tvshows" ADD "chronology" int
Migration AddChronologyToTVShows1776153600000 has been executed successfully.

migration:revert cleanly issues ALTER TABLE "tvshows" DROP COLUMN "chronology" and then migration:run re-applies. Both directions tested.

API behavior (after populating the 19 tvshows with chronology 41–59)

GET /api/v1/tvshows?order=chronology,asc&columns=id,title,chronology&limit=5&page=1

{
  "data": [
    { "id": 1, "title": "WandaVision", "chronology": 41 },
    { "id": 2, "title": "The Falcon and The Winter Soldier", "chronology": 42 },
    { "id": 3, "title": "Loki", "chronology": 43 },
    { "id": 4, "title": "What If...?", "chronology": 44 },
    { "id": 5, "title": "Hawkeye", "chronology": 45 }
  ],
  "total": 22
}

GET /api/v1/tvshows?filter=chronology=41 → 1 row (WandaVision), proving the numeric-column filter branch in TVShowsRepository.findAll treats chronology as an integer instead of an ILIKE pattern.

GET /api/v1/tvshows?columns=title,chronology&filter=chronology=59 → 1 row ({ "title": "What If...?", "chronology": 59 }), proving the new field flows through the columns selector.

All test-plan checkboxes (migration run, revert, order, filter, columns selection) are now validated.

Copy link
Copy Markdown
Owner Author

@AugustoMarcelo AugustoMarcelo left a comment

Choose a reason for hiding this comment

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

Code review done.

@AugustoMarcelo AugustoMarcelo merged commit 4f41ee5 into master Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion: Chronology for shows

1 participant