Skip to content

backend: subscriptions repository's findBySubscriber has no result limit, unlike every other repository's list method #848

Description

@gboigwe

Summary

findBySubscriber in the subscriptions repository returns an unbounded result set, inconsistent with every other repository's list method in this codebase.

Location

backend/src/db/repositories/subscriptions.ts, function findBySubscriber: findMany({ where: { subscriber }, orderBy: {...} }) with no take

Problem

Every other repository method checked (auctions, bids, campaigns, impressions, publishers, governance) takes an explicit limit/take parameter. findBySubscriber doesn't — if a single subscriber ever accumulates many subscription records over time, this query returns all of them, unbounded.

Impact

Low-medium currently (subscription counts per user are likely small today), but a real resource-usage risk as the system grows, and a clear inconsistency with the rest of the codebase's established pattern.

Acceptance Criteria

  • findBySubscriber takes an explicit take/limit parameter (with a sensible default and a cap), matching the pattern used elsewhere
  • Callers of findBySubscriber are updated if their call signature needs to change
  • npm test passes in backend/

Suggested Approach

Mirror whatever limit/pagination pattern an already-consistent repository (e.g. campaigns.ts or auctions.ts) uses.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbackendNodejs Express backendbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions