Skip to content

Commit

Permalink
fix: missing filter
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Nov 13, 2024
1 parent 5ee8c59 commit 729a14b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pre-commit:
WAIT
BUILD +openapi
END
BUILD +generate-client
#BUILD +generate-client

bench:
FROM core+builder-image
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- postgres:/data/postgres

ledger:
image: golang:1.19-alpine
image: golang:1.22-alpine
entrypoint: go run main.go serve
volumes:
- .:/src
Expand Down
8 changes: 4 additions & 4 deletions internal/api/v2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ func getPITOOTFilter(r *http.Request) (*ledgerstore.PITFilter, error) {
func getPITFilter(r *http.Request) (*ledgerstore.PITFilter, error) {
pitString := r.URL.Query().Get("pit")

pit := time.Now()
var pit *time.Time

if pitString != "" {
var err error
pit, err = time.ParseTime(pitString)
parsedPit, err := time.ParseTime(pitString)
if err != nil {
return nil, err
}
pit = &parsedPit
}

return &ledgerstore.PITFilter{
PIT: &pit,
PIT: pit,
}, nil
}

Expand Down
2 changes: 2 additions & 0 deletions internal/storage/ledgerstore/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func (store *Store) accountQueryContext(qb query.Builder, q GetAccountsQuery) (s
}

return fmt.Sprintf("%s -> ? IS NOT NULL", key), []any{value}, nil
case key == "first_usage":
return fmt.Sprintf("%s %s ?", key, query.DefaultComparisonOperatorsMapping[operator]), []any{value}, nil
default:
return "", nil, newErrInvalidQuery("unknown key '%s' when building query", key)
}
Expand Down

0 comments on commit 729a14b

Please sign in to comment.