Skip to content

Commit

Permalink
GetNews response empty response value fix (#13)
Browse files Browse the repository at this point in the history
GetNews response return [] instead of null for empty result.
  • Loading branch information
ice-myles authored Jun 9, 2023
1 parent 3ae5793 commit b0cacd1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/goccy/go-json v0.10.2
github.com/google/uuid v1.3.0
github.com/hashicorp/go-multierror v1.1.1
github.com/ice-blockchain/eskimo v1.116.0
github.com/ice-blockchain/eskimo v1.117.0
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb
github.com/ice-blockchain/wintr v1.114.0
github.com/imroc/req/v3 v3.35.2
Expand Down Expand Up @@ -134,7 +134,7 @@ require (
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.9.3 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.125.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine/v2 v2.0.3 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ice-blockchain/eskimo v1.116.0 h1:36BbAN0dMUiArkrBFEY3Pp8RBTo2lXUDfaIJBC6dRjk=
github.com/ice-blockchain/eskimo v1.116.0/go.mod h1:QA+tgl8WL5kmZeaXMXcWWlJQDdHLuhGtaSRXShjQdCs=
github.com/ice-blockchain/eskimo v1.117.0 h1:sP6TGdyqkJi8pCcvxcyU+1tZYJJMWAem+Y+IHJSxBJU=
github.com/ice-blockchain/eskimo v1.117.0/go.mod h1:+g7zx4JMqDvTpKiRiE89rRKbT2mkpaorKFVkQPYTuQo=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb h1:8TnFP3mc7O+tc44kv2e0/TpZKnEVUaKH+UstwfBwRkk=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb/go.mod h1:ZsQU7i3mxhgBBu43Oev7WPFbIjP4TniN/b1UPNGbrq8=
github.com/ice-blockchain/wintr v1.114.0 h1:eEV+F77Dvq/wyEAOsd5eefvId2FgkR/l9iSsaWOkIxU=
Expand Down Expand Up @@ -711,8 +711,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.125.0 h1:7xGvEY4fyWbhWMHf3R2/4w7L4fXyfpRGE9g6lp8+DCk=
google.golang.org/api v0.125.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw=
google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o=
google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
Expand Down
6 changes: 4 additions & 2 deletions news/news_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ func (r *repository) GetNews(ctx context.Context, newsType Type, language string
WHERE n.language = $2
AND n.type = $3
AND n.created_at >= $4
ORDER BY nvu.created_at IS NULL DESC,
n.created_at DESC
ORDER BY nvu.created_at IS NULL DESC, n.created_at DESC
LIMIT $5 OFFSET $6`
result, err := storage.Select[PersonalNews](ctx, r.db, sql, args...)
if err != nil {
return nil, errors.Wrapf(err, "failed to get news for args:%#v", args...)
}
if result == nil {
return []*PersonalNews{}, nil
}
for _, elem := range result {
elem.NotificationChannels = nil
elem.UpdatedAt = nil
Expand Down

0 comments on commit b0cacd1

Please sign in to comment.