refactor-location #134
|
@ -79,7 +79,6 @@ func (s Seller) GetListSellerInfoSupportChatByIDs(p model.GetListSellerSupportCh
|
|||
if err := json.Unmarshal(msg.Data, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r.Error != "" {
|
||||
return nil, errors.New(r.Error)
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ func GetSupplierUser() SupplierUser {
|
|||
return SupplierUser{}
|
||||
}
|
||||
|
||||
func (s SupplierUser) CreateSupplierUserS(p model.CreateSupplierUserRequest) (*model.CreateSupplierUserResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateSupplierUser, toBytes(p))
|
||||
func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateSupplierOwnerUserRequest) (*model.CreateSupplierUserOwnerResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateSupplierOwnerUser, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Data *model.CreateSupplierUserResponse `json:"data"`
|
||||
Error string `json:"error"`
|
||||
Data *model.CreateSupplierUserOwnerResponse `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
|
@ -36,3 +36,64 @@ func (s SupplierUser) CreateSupplierUserS(p model.CreateSupplierUserRequest) (*m
|
|||
|
||||
return r.Data, nil
|
||||
}
|
||||
|
||||
func (s SupplierUser) UpdateSupplierOwnerUsers(p model.UpdateSupplierOwnerUserRequest) error {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateSupplierOwnerUser, 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) CreateSupplierStaffUsers(p model.CreateSupplierStaffUserRequest) (*model.CreateSupplierUserStaffResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateSupplierStaffUser, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Data *model.CreateSupplierUserStaffResponse `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) UpdateSupplierStaffUsers(p model.CreateSupplierStaffUserRequest) error {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateSupplierStaffUser, 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
|
||||
}
|
||||
|
|
|
@ -21,16 +21,25 @@ type ResponseListSellerInfoSupportChat struct {
|
|||
|
||||
// ResponseSellerInfoSupportChat ...
|
||||
type ResponseSellerInfoSupportChat struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Membership SellerMembershipInfo `json:"membership"`
|
||||
Info SellerContactInfo `json:"info"`
|
||||
Team *TeamInfo `json:"team,omitempty"`
|
||||
Statistic SellerStatistic `json:"statistic"`
|
||||
TrackingTime *SellerTrackingTime `json:"trackingTime"`
|
||||
Invitee *InviteeInfo `json:"invitee"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Membership SellerMembershipInfo `json:"membership"`
|
||||
Info SellerContactInfo `json:"info"`
|
||||
Team *TeamInfo `json:"team,omitempty"`
|
||||
Statistic SellerStatistic `json:"statistic"`
|
||||
TrackingTime *SellerTrackingTime `json:"trackingTime"`
|
||||
Invitee *InviteeInfo `json:"invitee"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
PlanPackage *SellerPlanPackageInfo `json:"planPackage"`
|
||||
}
|
||||
|
||||
// SellerPlanPackageInfo ...
|
||||
type SellerPlanPackageInfo struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Level int `json:"level"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
// SellerTrackingTime ...
|
||||
|
|
|
@ -1,10 +1,41 @@
|
|||
package model
|
||||
|
||||
type CreateSupplierUserRequest struct {
|
||||
Name string `json:"name"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
Supplier string `json:"supplier"`
|
||||
Role string `json:"role"`
|
||||
Password string `json:"password"`
|
||||
type CreateSupplierOwnerUserRequest struct {
|
||||
Name string `json:"name"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
SupplierID string `json:"supplierId"`
|
||||
RoleID string `json:"roleId"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UpdateSupplierOwnerUserRequest struct {
|
||||
ID string `json:"_id"`
|
||||
SupplierID string `json:"supplierId"`
|
||||
Name string `json:"name"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
RoleID string `json:"roleId"`
|
||||
}
|
||||
|
||||
type CreateSupplierStaffUserRequest struct {
|
||||
Name string `json:"name"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
SupplierID string `json:"supplierId"`
|
||||
RoleID string `json:"roleId"`
|
||||
Password string `json:"password"`
|
||||
Warehouses []string `json:"warehouses"`
|
||||
}
|
||||
|
||||
type UpdateSupplierStaffUserRequest struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
Phone string `json:"phone"`
|
||||
Email string `json:"email"`
|
||||
SupplierID string `json:"supplierId"`
|
||||
Role string `json:"role"`
|
||||
Password string `json:"password"`
|
||||
Warehouses []string `json:"warehouses"`
|
||||
RoleId string `json:"roleId"`
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package model
|
||||
|
||||
type CreateSupplierUserResponse struct {
|
||||
type CreateSupplierUserOwnerResponse struct {
|
||||
ID string `json:"_id"`
|
||||
}
|
||||
|
||||
type CreateSupplierUserStaffResponse struct {
|
||||
ID string `json:"_id"`
|
||||
}
|
||||
|
|
|
@ -7,7 +7,13 @@ func getAuthSMSValue(val string) string {
|
|||
}
|
||||
|
||||
var SupplierUser = struct {
|
||||
CreateSupplierUser string
|
||||
CreateSupplierOwnerUser string
|
||||
UpdateSupplierOwnerUser string
|
||||
CreateSupplierStaffUser string
|
||||
UpdateSupplierStaffUser string
|
||||
}{
|
||||
CreateSupplierUser: getAuthSMSValue("create_supplier_user"),
|
||||
CreateSupplierOwnerUser: getAuthSMSValue("create_supplier_owner_user"),
|
||||
UpdateSupplierOwnerUser: getAuthSMSValue("update_supplier_owner_user"),
|
||||
CreateSupplierStaffUser: getAuthSMSValue("create_supplier_staff_user"),
|
||||
UpdateSupplierStaffUser: getAuthSMSValue("update_supplier_staff_user"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue