From 1658b029260dc2a16f8cddc675c074dc71a34a0b Mon Sep 17 00:00:00 2001 From: xushuhui Date: Wed, 20 Apr 2022 18:20:29 +0800 Subject: [PATCH] fix tags mapping --- model/rbac/user.go | 4 ++-- plugin/api/rbac/user.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/rbac/user.go b/model/rbac/user.go index 266379a9..1cd131b3 100644 --- a/model/rbac/user.go +++ b/model/rbac/user.go @@ -9,8 +9,8 @@ type User struct { Name string `json:"name" elastic_mapping:"name:{type:keyword}"` Phone string `json:"phone" elastic_mapping:"phone:{type:keyword}"` Email string `json:"email" elastic_mapping:"email:{type:keyword}"` - Roles []UserRole `json:"roles" elastic_mapping:"roles:{type:text}"` - Tags []string `json:"tags" elastic_mapping:"tags:{type:text}"` + Roles []UserRole `json:"roles"` + Tags []string `json:"tags,omitempty" elastic_mapping:"tags:{type:text}"` } type UserRole struct { Id string `json:"id" elastic_mapping:"id:{type:keyword}"` diff --git a/plugin/api/rbac/user.go b/plugin/api/rbac/user.go index 5b8c1de2..d9bff0de 100644 --- a/plugin/api/rbac/user.go +++ b/plugin/api/rbac/user.go @@ -150,7 +150,7 @@ func (h Rbac) SearchUser(w http.ResponseWriter, r *http.Request, ps httprouter.P return } - h.WriteOKJSON(w, core.Response{Hit: res.Result, Total: res.Total}) + h.WriteOKJSON(w, res) return }