Skip to content

Feature/refacto#28

Merged
miicolas merged 17 commits into
devfrom
feature/refacto
Jun 9, 2026
Merged

Feature/refacto#28
miicolas merged 17 commits into
devfrom
feature/refacto

Conversation

@miicolas

@miicolas miicolas commented Jun 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

miicolas and others added 17 commits June 9, 2026 21:25
Remove unresolved <<<<<<</>/>>>>>>> markers; keep the short "theirs"
version that points to AGENTS.md as the single source of truth.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bump better-auth to ^1.6.14, @elysia/eden to ^1.4.10, and
drizzle-orm to ^0.45.2 so all workspaces share the same range;
regenerate bun.lock accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dules

client.ts (363 lines, 4 concerns) → 5 dedicated files:
- constants.ts  language/region defaults, TTL values, DETAIL_APPEND,
                MEDIA_GENRE_SHELVES, OFFER_TYPES
- types.ts      MediaType, MediaFilter, TmdbMovieSummary, etc.
- normalize.ts  normalizeSummary, hasRating, combine, interleave
- persist.ts    upsertMovieDetail, upsertMovieList, upsertMediaProviders
- summaries.ts  discover(), trending() list fetchers
- client.ts     HTTP fetch + Redis cache only (~80 lines)

All existing public imports updated; index.ts re-exports unchanged.
analytics/discovery-flow.ts line-wrapped by the formatter run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add isMediaType() and asMediaType() to @seen/shared so DB strings
can be validated at runtime instead of blindly cast. Replaces all
'as MediaType' and 'as "movie" | "tv"' in the similarity module,
recommendations feed, and the backfill-keywords trigger task (10 sites).
asMediaType() throws with the raw value on mismatch, surfacing bad data
early rather than silently propagating the wrong type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The pattern insert → onConflictDoNothing → fallback select → HttpError(500)
was copy-pasted across three mutations (likes, watchlist, not-interested).
Replace with a typed insertOrGet({ insert, find, errorMessage }) helper
that returns { row, inserted: boolean }, so callers can gate first-write
side-effects (similarity refresh) cleanly without duplicate logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
record-swipes: empty catch{} now logs the failing item
(media_type:tmdb_id) at error level; behavior stays best-effort.
index.ts: warn at startup when TRIGGER_SECRET_KEY is absent so it
is clear that similarity rebuilds will run inline (not via Trigger.dev).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auth.ts (Better Auth) and preferences/schema.ts already used
.\$onUpdate(() => new Date()); apply the same to the 12 remaining
updatedAt columns across 8 schemas so Drizzle keeps them in sync on
every application-level write. No migration needed (application-level only).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers the three rawKeywordList shapes (movie keywords.keywords,
tv keywords.results, already-flat array from a cached DTO re-map),
malformed entries that must be dropped, and the tv name/first_air_date
field fallback. The CI bun-test job was previously passing trivially
on an empty suite; these 6 cases give it real coverage of the
most fragile part of the TMDB detail mapping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Web is not a target platform. This was the last remaining .web.* file;
removing it eliminates dead code and a stale import path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FILTER_OPTIONS was copy-pasted identically in discover.tsx and
watchlist.tsx. Extract into:
- constants/media-filters.ts    MEDIA_FILTER_OPTIONS constant
- hooks/use-media-filter.ts     state + haptic + label logic
- components/ui/media-filter-toolbar.tsx  shared nav-bar toolbar

discover.tsx is now a thin consumer; watchlist will follow in the
next commit when its screen is split.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
watchlist.tsx (259 lines, 2 concerns) → watchlist/:
- index.tsx       main WatchList component using useMediaFilter +
                  MediaFilterToolbar
- watchlist-row.tsx  extracted WatchlistRow with SwipeActions,
                     RNHostView, ExpoImage, Link.AppleZoom

Follows the project convention: create a folder once a screen
has 2+ sibling files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
onboarding.tsx (277 lines, 4 concerns) → onboarding/:
- index.tsx             main Onboarding component (182 lines)
- auth-buttons.tsx      AuthButtons + private GlassButton (SwiftUI glass)
- use-parallax-tilt.ts  gyroscope parallax animation hook
- palette.ts            named color constants for the intentionally
                        dark auth surface (not theme tokens —
                        this screen is theme-independent by design)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
edit-profile-form.tsx (333 lines) → edit-profile-form/:
- index.tsx               form orchestration (231 lines)
- avatar-picker.tsx       image picker with camera badge;
                          calls onPick(avatar) / onError(msg)
- delete-account-section.tsx  double-confirm Alert flow before
                              account deletion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
'note' is a banned vocabulary token per the naming skill.
The StyleSheet key is renamed to 'caption'; no visual change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MediaType was redefined locally in apps/mobile/src/lib/tmdb/types.ts
instead of imported from the canonical @seen/shared package.
MediaFilter stays local as it extends MediaType with "all".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Switch 8 service handlers from the untyped eden cast (Record<string,any>)
to the typed api export. TypeScript now validates call shapes at compile
time. Only ergonomic difference found: a DELETE with no body requires {}
as first argument instead of undefined with the typed client.
Remaining ~50 handlers in other services can be migrated incrementally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@miicolas miicolas merged commit 4d2e3a6 into dev Jun 9, 2026
2 checks passed
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.

1 participant