build auth sms

This commit is contained in:
Tue 2022-11-03 10:46:56 +07:00
parent 49426e322c
commit 9407b2df6b
4 changed files with 10 additions and 11 deletions

View File

@ -37,15 +37,15 @@ func (s SupplierUser) LoginUser(p model.LoginUserRequest) (*model.LoginUserRespo
return r.Data, nil
}
func (s SupplierUser) GetListOwner(p model.GetListOwnerRequest) (*model.GetListOwnerResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.GetListOwner, toBytes(p))
func (s SupplierUser) GetListUser(p model.GetListUserRequest) (*model.GetListUserResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.GetListUser, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.GetListOwnerResponse `json:"data"`
Error string `json:"error"`
Data *model.GetListUserResponse `json:"data"`
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
@ -141,7 +141,7 @@ func (s SupplierUser) UpdateSupplierStaffUsers(p model.UpdateStaffRequest) error
}
func (s SupplierUser) UpdateStatus(p model.UpdateStatusRequest) error {
msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStaff, toBytes(p))
msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStatus, toBytes(p))
if err != nil {
return err
}

View File

@ -17,7 +17,7 @@ type LoginUserRequest struct {
IsMobile bool `json:"isMobile"`
}
type GetListOwnerRequest struct {
type GetListUserRequest struct {
Page int `json:"page"`
Limit int `json:"limit"`
Status string `json:"status"`
@ -71,6 +71,5 @@ type UpdateStatusRequest struct {
}
type ResetPasswordRequest struct {
ID string `json:"_id"`
Password string `json:"password"`
ID string `json:"_id"`
}

View File

@ -7,7 +7,7 @@ type LoginUserResponse struct {
SupplierID string `json:"supplierId"`
}
type GetListOwnerResponse struct {
type GetListUserResponse struct {
SupplierUsers []SupplierUserBrief `json:"supplierUsers"`
Total int64 `json:"total"`
}

View File

@ -9,7 +9,7 @@ func getSupplierUserValue(val string) string {
var SupplierUser = struct {
// Users
LoginUser string
GetListOwner string
GetListUser string
CreateOwner string
UpdateOwner string
CreateStaff string
@ -19,7 +19,7 @@ var SupplierUser = struct {
}{
// Users
LoginUser: getSupplierUserValue("login_user"),
GetListOwner: getSupplierUserValue("get_list_owner"),
GetListUser: getSupplierUserValue("get_list_user"),
CreateOwner: getSupplierUserValue("create_owner"),
UpdateOwner: getSupplierUserValue("update_owner"),
CreateStaff: getSupplierUserValue("create_staff"),