Skip to content

feat: usage aggregate by hour - #976

Merged
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
eliassmthl-collab:feature/aggregate-hour
Jul 28, 2026
Merged

feat: usage aggregate by hour#976
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
eliassmthl-collab:feature/aggregate-hour

Conversation

@eliassmthl-collab

Copy link
Copy Markdown

Implement GET /api/usage/aggregate — returns per-hour call counts and revenue for the authenticated developer, optionally filtered by from/to/apiId. Defaults to the last 24 hours when no dates are supplied.

Changes:

  • src/routes/usage/aggregate.ts new route handler
  • src/routes/usage/aggregate.test.ts 14 focused tests (all passing)
  • src/routes/index.ts mount /usage/aggregate
  • src/repositories/usageEventsRepository.ts
    add UsageHourBucket type, aggregateByHour to interface + InMemory impl
    extend GroupBy union with 'hour'
  • src/repositories/usageEventsRepository.pg.ts
    PgUsageEventsRepository.aggregateByHour using DATE_TRUNC('hour')
  • docs/usage-aggregate.md full API reference
  • README.md add endpoint to What's included

Closes #602

Implement GET /api/usage/aggregate — returns per-hour call counts and
revenue for the authenticated developer, optionally filtered by
from/to/apiId. Defaults to the last 24 hours when no dates are supplied.

Changes:
- src/routes/usage/aggregate.ts         new route handler
- src/routes/usage/aggregate.test.ts    14 focused tests (all passing)
- src/routes/index.ts                   mount /usage/aggregate
- src/repositories/usageEventsRepository.ts
    add UsageHourBucket type, aggregateByHour to interface + InMemory impl
    extend GroupBy union with 'hour'
- src/repositories/usageEventsRepository.pg.ts
    PgUsageEventsRepository.aggregateByHour using DATE_TRUNC('hour')
- docs/usage-aggregate.md               full API reference
- README.md                             add endpoint to What's included

Closes CalloraOrg#602
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@eliassmthl-collab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit 8f2516c into CalloraOrg:main Jul 28, 2026
1 check failed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

LGTM — clean diff and clear commits. Thanks!

@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 28, 2026
4 tasks
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.

Add /api/usage/aggregate by hour

2 participants