Skip to content

refactor(media): move toRow mapper out of reads.ts into shared repo utility #529

@electather

Description

@electather

Context

Flagged as a non-blocking observation in PR #526 review.

apps/server/src/media/repo/writes.ts:8 imports toRow from ./reads:

import { toRow } from "./reads";

toRow is a private mapper (typeof watchlistItems.$inferSelect → ActiveRow) defined in reads.ts and used by both reads.ts and writes.ts. The current cross-file dependency means any signature change to toRow touches both files, and the coupling is implicit (reads → internal detail leaked to writes).

Proposed fix

Move toRow to a dedicated apps/server/src/media/repo/row.ts (or cursor.ts) so both reads and writes import from a shared, clearly-named location. Makes the coupling explicit and easier to find.

Why deferred

Low risk in practice — toRow is unexported and the dependency direction is clear from naming. Deferred to avoid scope creep in #526.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions