From d85b4c9760b26fdf7c56918f837bad0ba2d699e9 Mon Sep 17 00:00:00 2001 From: Hoang Date: Tue, 28 Dec 2021 15:37:57 +0700 Subject: [PATCH] update UserAllQuery --- model/user_request.go | 2 ++ user/handle.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/model/user_request.go b/model/user_request.go index a99c314..d7a8435 100644 --- a/model/user_request.go +++ b/model/user_request.go @@ -5,6 +5,7 @@ import ( "github.com/Selly-Modules/logger" "github.com/Selly-Modules/usermngmt/internal" + "go.mongodb.org/mongo-driver/bson" ) // UserCreateOptions ... @@ -44,6 +45,7 @@ type UserAllQuery struct { Status string Sort interface{} Other map[string]interface{} // query fields in other object + Cond bson.M } // UserCountQuery ... diff --git a/user/handle.go b/user/handle.go index 3dd5083..05dceb2 100644 --- a/user/handle.go +++ b/user/handle.go @@ -157,6 +157,10 @@ func All(queryParams model.UserAllQuery) (r model.UserAll) { wg sync.WaitGroup cond = bson.M{} ) + if queryParams.Cond != nil { + cond = queryParams.Cond + } + query := model.CommonQuery{ Page: queryParams.Page, Limit: queryParams.Limit,