feat: add filter by status on GET /users (#1206)

This commit is contained in:
Bruno Quaresma
2022-04-29 08:29:53 -05:00
committed by GitHub
parent 82364d174f
commit ba4c3ce3b9
7 changed files with 116 additions and 37 deletions
+6 -4
View File
@@ -90,10 +90,11 @@ func (api *api) postFirstUser(rw http.ResponseWriter, r *http.Request) {
func (api *api) users(rw http.ResponseWriter, r *http.Request) {
var (
afterArg = r.URL.Query().Get("after_user")
limitArg = r.URL.Query().Get("limit")
offsetArg = r.URL.Query().Get("offset")
searchName = r.URL.Query().Get("search")
afterArg = r.URL.Query().Get("after_user")
limitArg = r.URL.Query().Get("limit")
offsetArg = r.URL.Query().Get("offset")
searchName = r.URL.Query().Get("search")
statusFilter = r.URL.Query().Get("status")
)
// createdAfter is a user uuid.
@@ -136,6 +137,7 @@ func (api *api) users(rw http.ResponseWriter, r *http.Request) {
OffsetOpt: int32(offset),
LimitOpt: int32(pageLimit),
Search: searchName,
Status: statusFilter,
})
if err != nil {
httpapi.Write(rw, http.StatusInternalServerError, httpapi.Response{