Skip to content

feat(api): add in_successful_call filter to GET /events (Resolves #211) - #455

Merged
khaylebfortune merged 2 commits into
sorotrail:mainfrom
teeschima:issue-211-in-successful-call-filter
Aug 3, 2026
Merged

feat(api): add in_successful_call filter to GET /events (Resolves #211)#455
khaylebfortune merged 2 commits into
sorotrail:mainfrom
teeschima:issue-211-in-successful-call-filter

Conversation

@teeschima

Copy link
Copy Markdown
Contributor

Summary

Resolves #211 — adds ?in_successful_call=true|false to GET /events (and GET /contracts/{id}/events, which shares the filter parser) to filter diagnostic events from failed calls vs successful-call events.

What changed

  • internal/store/store.goEventFilter gains InSuccessfulCall *bool: nil means "no constraint", true/false filter explicitly. A pointer (not a plain bool) so "absent" stays distinguishable from false.
  • internal/store/postgres.goQueryEvents appends the parameterized clause in_successful_call = $N when the filter is set; unset filters keep the exact previous SQL.
  • internal/api/handlers.gofilterFromQuery parses in_successful_call (true | false); any other value is a 400. Absent (or empty) means no constraint.
  • internal/api/api_test.go — table-driven TestListEvents_InSuccessfulCallFilter (omitted / true / false) plus in_successful_call=maybe added to the invalid-params suite.
  • internal/store/postgres_test.go — integration test against a real database: successful-only, failed-only, and nil (no constraint) queries, table-driven.
  • README.md — the new parameter is documented in the GET /events API reference table.

Design notes

  • *bool semantics match the convention the project later adopted upstream: nil = no filter, so existing requests behave byte-for-byte as before.
  • No schema, config, or endpoint changes — the in_successful_call column already exists.

Testing

  • go build ./..., go vet ./..., golangci-lint run, and go test ./... all pass, including the Postgres integration suite.

Closes #211

@khaylebfortune
khaylebfortune merged commit 1f3358e into sorotrail:main Aug 3, 2026
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 in_successful_call filter to GET /events

2 participants