mergeDev/campaign #73

Closed
Ghost wants to merge 208 commits from mergeDev/campaign into develop
3 changed files with 71 additions and 18 deletions
Showing only changes of commit 3507d17029 - Show all commits

View File

@ -37,6 +37,26 @@ func (s SupplierUser) LoginUser(p model.LoginUserRequest) (*model.LoginUserRespo
return r.Data, nil return r.Data, nil
} }
func (s SupplierUser) Logout(p model.LogoutRequest) error {
msg, err := natsio.GetServer().Request(subject.SupplierUser.Logout, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}
func (s SupplierUser) GetListUser(p model.GetListUserRequest) (*model.GetListUserResponse, error) { func (s SupplierUser) GetListUser(p model.GetListUserRequest) (*model.GetListUserResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.GetListUser, toBytes(p)) msg, err := natsio.GetServer().Request(subject.SupplierUser.GetListUser, toBytes(p))
if err != nil { if err != nil {
@ -201,3 +221,23 @@ func (s SupplierUser) ResetPassword(p model.ResetPasswordRequest) (*model.ResetP
return r.Data, nil return r.Data, nil
} }
func (s SupplierUser) ChangePassword(p model.ChangePasswordRequest) error {
msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStatus, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}

View File

@ -17,6 +17,10 @@ type LoginUserRequest struct {
IsMobile bool `json:"isMobile"` IsMobile bool `json:"isMobile"`
} }
type LogoutRequest struct {
ID string `json:"_id"`
}
type GetListUserRequest struct { type GetListUserRequest struct {
Page int `json:"page"` Page int `json:"page"`
Limit int `json:"limit"` Limit int `json:"limit"`
@ -75,3 +79,8 @@ type UpdateStatusRequest struct {
type ResetPasswordRequest struct { type ResetPasswordRequest struct {
ID string `json:"_id"` ID string `json:"_id"`
} }
type ChangePasswordRequest struct {
ID string `json:"_id"`
Password string `json:"password"`
}

View File

@ -8,24 +8,28 @@ func getSupplierUserValue(val string) string {
var SupplierUser = struct { var SupplierUser = struct {
// Users // Users
LoginUser string LoginUser string
GetListUser string Logout string
DetailUser string GetListUser string
CreateOwner string DetailUser string
UpdateOwner string CreateOwner string
CreateStaff string UpdateOwner string
UpdateStaff string CreateStaff string
UpdateStatus string UpdateStaff string
ResetPassword string UpdateStatus string
ResetPassword string
ChangePassword string
}{ }{
// Users // Users
LoginUser: getSupplierUserValue("login_user"), LoginUser: getSupplierUserValue("login_user"),
GetListUser: getSupplierUserValue("get_list_user"), Logout: getSupplierUserValue("logout"),
DetailUser: getSupplierUserValue("detail_user"), GetListUser: getSupplierUserValue("get_list_user"),
CreateOwner: getSupplierUserValue("create_owner"), DetailUser: getSupplierUserValue("detail_user"),
UpdateOwner: getSupplierUserValue("update_owner"), CreateOwner: getSupplierUserValue("create_owner"),
CreateStaff: getSupplierUserValue("create_staff"), UpdateOwner: getSupplierUserValue("update_owner"),
UpdateStaff: getSupplierUserValue("update_staff"), CreateStaff: getSupplierUserValue("create_staff"),
UpdateStatus: getSupplierUserValue("update_status"), UpdateStaff: getSupplierUserValue("update_staff"),
ResetPassword: getSupplierUserValue("reset_password"), UpdateStatus: getSupplierUserValue("update_status"),
ResetPassword: getSupplierUserValue("reset_password"),
ChangePassword: getSupplierUserValue("change_password"),
} }