Skip to content

Implement Usage Events Repository #16

@greatest0fallt1me

Description

@greatest0fallt1me

Description
Implement usage_events repository: create(event), findByUserId(userId, from, to, limit), findByApiId(apiId, from, to, limit), getTotalSpentByUser(userId, from, to), getTotalRevenueByApi(apiId, from, to). Support idempotency by request_id (unique constraint).

Requirements and context

  • create must be idempotent on request_id to avoid double billing
  • All amounts in consistent units (e.g. USDC smallest unit)

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feature/usage-events-repository
  • Implement changes
    • Implement create (ON CONFLICT request_id DO NOTHING or return existing), aggregates
    • Add unit tests
  • Test and commit
    • Run tests
    • Example commit message: feat: usage events repository with idempotency

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours
  • Project details: #

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions