Skip to content

Commit

Permalink
Merge branch 'main' into issue-52
Browse files Browse the repository at this point in the history
  • Loading branch information
flemzord authored Oct 26, 2021
2 parents 2c6a50b + 108758c commit b923367
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/api/ @numary/core
/cmd/ @numary/core
/config/ @numary/core
/core/ @numary/core
/ledger/ @numary/core
*.go @numary/core

/.devcontainer @flemzord
/.github @flemzord
23 changes: 23 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'@domain/core':
- core/*
- core/**/*

'@domain/api':
- api/*
- api/**/*

'@domain/ledger':
- ledger/*
- ledger/**/*

'@domain/storage':
- storage/*
- storage/**/*

'@domain/cmd':
- cmd/*
- cmd/**/*

'@domain/ci':
- .github/*
- .github/**/*
12 changes: 12 additions & 0 deletions .github/workflows/pr_open_target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target
- pull_request

jobs:
Triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
3 changes: 2 additions & 1 deletion api/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ func NewHttpAPI(lc fx.Lifecycle, resolver *ledger.Resolver) *HttpAPI {

r.GET("/:ledger/transactions", func(c *gin.Context) {
l, _ := c.Get("ledger")
ref := c.Query("reference")

cursor, err := l.(*ledger.Ledger).FindTransactions(
query.After(c.Query("after")),
query.Account(c.Query("account")),
query.Reference(ref),
)

c.JSON(200, gin.H{
Expand Down
6 changes: 6 additions & 0 deletions ledger/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,9 @@ func Destination(v string) func(*Query) {
q.Params["destination"] = v
}
}

func Reference(v string) func(*Query) {
return func(q *Query) {
q.Params["reference"] = v
}
}
6 changes: 6 additions & 0 deletions storage/postgres/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ func (s *PGStore) FindTransactions(q query.Query) (query.Cursor, error) {
))
}

if q.HasParam("reference") {
in.Where(
in.Equal("reference", q.Params["reference"]),
)
}

sb := sqlbuilder.NewSelectBuilder()
sb.Select(
"t.id",
Expand Down
6 changes: 6 additions & 0 deletions storage/sqlite/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ func (s *SQLiteStore) FindTransactions(q query.Query) (query.Cursor, error) {
))
}

if q.HasParam("reference") {
in.Where(
in.Equal("reference", q.Params["reference"]),
)
}

sb := sqlbuilder.NewSelectBuilder()
sb.Select(
"t.id",
Expand Down

0 comments on commit b923367

Please sign in to comment.