Skip to content

Commit

Permalink
BE-636 | Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deividaspetraitis committed Nov 15, 2024
1 parent d0d766e commit 76bb7b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
26 changes: 10 additions & 16 deletions pkg/api/v1beta1/pools/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,21 @@ func (r *GetPoolsRequest) UnmarshalHTTPRequest(c echo.Context) error {
return err
}

var pagination v1beta1.PaginationRequest
if !(&pagination).IsPresent(c) {
return nil // pagination is optional and is not present
}
if pagination := new(v1beta1.PaginationRequest); pagination.IsPresent(c) {
if err := pagination.UnmarshalHTTPRequest(c); err != nil {
return err
}

if err := (&pagination).UnmarshalHTTPRequest(c); err != nil {
return err
r.Pagination = pagination
}

r.Pagination = &pagination

var sort v1beta1.SortRequest
if !(&sort).IsPresent(c) {
return nil // sort is optional and is not present
}
if sort := new(v1beta1.SortRequest); sort.IsPresent(c) {
if err := sort.UnmarshalHTTPRequest(c); err != nil {
return err
}

if err := (&sort).UnmarshalHTTPRequest(c); err != nil {
return err
r.Sort = sort
}

r.Sort = &sort

return nil
}
1 change: 0 additions & 1 deletion pools/usecase/pools_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ func (p *poolsUseCase) GetPools(opts ...domain.PoolsOption) ([]sqsdomain.PoolI,
var sortopts []func(sqsdomain.PoolI, sqsdomain.PoolI) bool
if s := options.Sort; s != nil {
for _, v := range s.Fields {
fmt.Println(v)
switch v.Field {
case "id":
sortopts = append(sortopts, func(a, b sqsdomain.PoolI) bool {
Expand Down

0 comments on commit 76bb7b0

Please sign in to comment.