From cdbbf9fc738d771c77dd8305145c00aff1f07e22 Mon Sep 17 00:00:00 2001 From: Tue Date: Wed, 2 Nov 2022 14:56:58 +0700 Subject: [PATCH] build auth sms --- client/supplier_role.go | 1 - model/supplier_permission_response.go | 7 +++++++ model/supplier_role_request.go | 2 ++ model/supplier_role_response.go | 23 +++++++++++++---------- model/supplier_user_request.go | 1 + 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/client/supplier_role.go b/client/supplier_role.go index 1fe6d9d..095f3e9 100644 --- a/client/supplier_role.go +++ b/client/supplier_role.go @@ -26,7 +26,6 @@ func (s SupplierRole) GetListRole(p model.GetListRoleRequest) (*model.GetListRol Data *model.GetListRoleResponse `json:"data"` Error string `json:"error"` } - if err = json.Unmarshal(msg.Data, &r); err != nil { return nil, err } diff --git a/model/supplier_permission_response.go b/model/supplier_permission_response.go index cbbb019..8134201 100644 --- a/model/supplier_permission_response.go +++ b/model/supplier_permission_response.go @@ -17,3 +17,10 @@ type PermissionBrief struct { type CreatePermissionResponse struct { ID string `json:"_id"` } + +type PermissionShort struct { + ID string `json:"_id"` + Name string `json:"name"` + Code string `json:"code"` + Group string `json:"group"` +} diff --git a/model/supplier_role_request.go b/model/supplier_role_request.go index 3629643..ee12d59 100644 --- a/model/supplier_role_request.go +++ b/model/supplier_role_request.go @@ -15,6 +15,7 @@ type CreateRoleRequest struct { Name string `json:"name"` Code string `json:"code"` Type string `json:"type"` + SupplierID string `json:"supplierId"` Permissions []string `json:"permissions"` } @@ -23,5 +24,6 @@ type UpdateRoleRequest struct { Name string `json:"name"` Code string `json:"code"` Type string `json:"type"` + SupplierID string `json:"supplierId"` Permissions []string `json:"permissions"` } diff --git a/model/supplier_role_response.go b/model/supplier_role_response.go index cebc081..b67a0c6 100644 --- a/model/supplier_role_response.go +++ b/model/supplier_role_response.go @@ -6,12 +6,14 @@ type GetListRoleResponse struct { } type RoleBrief struct { - ID string `json:"_id"` - Name string `json:"name"` - Code string `json:"code"` - Type string `json:"type"` - CreatedAt string `json:"createdAt"` - UpdatedAt string `json:"updatedAt"` + ID string `json:"_id"` + Name string `json:"name"` + Code string `json:"code"` + Type string `json:"type"` + Permissions []PermissionShort `json:"permissions"` + SupplierId string `json:"supplierId"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` } type CreateRoleResponse struct { @@ -19,8 +21,9 @@ type CreateRoleResponse struct { } type RoleShort struct { - ID string `json:"_id"` - Name string `json:"name"` - Code string `json:"code"` - Type string `json:"type"` + ID string `json:"_id"` + Name string `json:"name"` + Code string `json:"code"` + Type string `json:"type"` + SupplierId string `json:"supplierId"` } diff --git a/model/supplier_user_request.go b/model/supplier_user_request.go index 9c6aca1..6bb81a0 100644 --- a/model/supplier_user_request.go +++ b/model/supplier_user_request.go @@ -4,6 +4,7 @@ type GetListOwnerRequest struct { Page int `json:"page"` Limit int `json:"limit"` Status string `json:"status"` + Type string `json:"type"` SupplierID string `json:"supplierId"` }