Skip to content

Issue #67 — Share position repository #464

@GoSTEAN

Description

@GoSTEAN

Title: [Repository] Implement share position repository

Tags: backend, repository, trading, feature

Description:
Dedicated repository for reading and writing user share positions, used by trading and redemption flows.

Acceptance Criteria:

  • share.repository.ts provides: getPosition(userId, marketId, outcomeId), upsertPosition, getAllForUser(userId), getAllForMarket(marketId), deletePosition.
  • upsertPosition is atomic — uses DB ON CONFLICT DO UPDATE.
  • getAllForUser supports pagination and status filter (open, redeemed).
  • All queries select only needed columns (avoid SELECT *).
  • Unit test: upsert new → upsert again → single record updated correctly.

File: src/repositories/share.repository.ts


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions