refactor-location #134

Closed
trunglam wants to merge 270 commits from refactor-location into master
3 changed files with 27 additions and 0 deletions
Showing only changes of commit 283974d869 - Show all commits

View File

@ -58,6 +58,27 @@ func (s SupplierUser) GetListUser(p model.GetListUserRequest) (*model.GetListUse
return r.Data, nil
}
func (s SupplierUser) DetailUser(p model.DetailUserRequest) (*model.SupplierUserBrief, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.DetailUser, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.SupplierUserBrief `json:"data"`
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return nil, err
}
if r.Error != "" {
return nil, errors.New(r.Error)
}
return r.Data, nil
}
func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateOwnerRequest) (*model.CreateOwnerResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p))
if err != nil {

View File

@ -25,6 +25,10 @@ type GetListUserRequest struct {
SupplierID string `json:"supplierId"`
}
type DetailUserRequest struct {
ID string `json:"_id"`
}
type CreateOwnerRequest struct {
Name string `json:"name"`
Phone string `json:"phone"`

View File

@ -10,6 +10,7 @@ var SupplierUser = struct {
// Users
LoginUser string
GetListUser string
DetailUser string
CreateOwner string
UpdateOwner string
CreateStaff string
@ -20,6 +21,7 @@ var SupplierUser = struct {
// Users
LoginUser: getSupplierUserValue("login_user"),
GetListUser: getSupplierUserValue("get_list_user"),
DetailUser: getSupplierUserValue("detail_user"),
CreateOwner: getSupplierUserValue("create_owner"),
UpdateOwner: getSupplierUserValue("update_owner"),
CreateStaff: getSupplierUserValue("create_staff"),