update UserAllQuery

This commit is contained in:
Hoang 2021-12-28 15:37:57 +07:00
parent 81df358020
commit d85b4c9760
2 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/Selly-Modules/logger" "github.com/Selly-Modules/logger"
"github.com/Selly-Modules/usermngmt/internal" "github.com/Selly-Modules/usermngmt/internal"
"go.mongodb.org/mongo-driver/bson"
) )
// UserCreateOptions ... // UserCreateOptions ...
@ -44,6 +45,7 @@ type UserAllQuery struct {
Status string Status string
Sort interface{} Sort interface{}
Other map[string]interface{} // query fields in other object Other map[string]interface{} // query fields in other object
Cond bson.M
} }
// UserCountQuery ... // UserCountQuery ...

View File

@ -157,6 +157,10 @@ func All(queryParams model.UserAllQuery) (r model.UserAll) {
wg sync.WaitGroup wg sync.WaitGroup
cond = bson.M{} cond = bson.M{}
) )
if queryParams.Cond != nil {
cond = queryParams.Cond
}
query := model.CommonQuery{ query := model.CommonQuery{
Page: queryParams.Page, Page: queryParams.Page,
Limit: queryParams.Limit, Limit: queryParams.Limit,