fix conflict
This commit is contained in:
commit
f09f9412fd
|
@ -274,23 +274,3 @@ func (s Supplier) DeleteCashflow(p model.SupplierDeleteCashflowReq) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckTokenSupplier ...
|
||||
func (s Supplier) CheckTokenSupplier(p model.CheckTokenSupplierPayload) (*model.ResponseCheckTokenSupplier, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Supplier.CheckTokenSupplier, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Error string `json:"error"`
|
||||
Data *model.ResponseCheckTokenSupplier `json:"data"`
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
|
@ -241,3 +241,23 @@ func (s SupplierUser) ChangePassword(p model.ChangePasswordRequest) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckTokenSupplier ...
|
||||
func (s SupplierUser) CheckTokenSupplier(p model.CheckTokenSupplierUserPayload) (*model.ResponseCheckTokenSupplierUser, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.SupplierUser.CheckToken, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Error string `json:"error"`
|
||||
Data *model.ResponseCheckTokenSupplierUser `json:"data"`
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
|
@ -62,9 +62,3 @@ type SupplierCountReq struct {
|
|||
IDs []string `json:"ids"`
|
||||
Status string `json:"status"` // active,inactive
|
||||
}
|
||||
|
||||
// CheckTokenSupplierPayload ...
|
||||
type CheckTokenSupplierPayload struct {
|
||||
Token string `json:"token"`
|
||||
Permissions []string `json:"permissions"`
|
||||
}
|
||||
|
|
|
@ -84,10 +84,3 @@ type SyncSupplierWarehousePayload struct {
|
|||
type SupplierCountRes struct {
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
// ResponseCheckTokenSupplier ...
|
||||
type ResponseCheckTokenSupplier struct {
|
||||
IsValid bool `json:"isValid"`
|
||||
Reason string `json:"reason"`
|
||||
Supplier ResponseSupplierInfo `json:"supplier"`
|
||||
}
|
||||
|
|
|
@ -84,3 +84,9 @@ type ChangePasswordRequest struct {
|
|||
ID string `json:"_id"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// CheckTokenSupplierUserPayload ...
|
||||
type CheckTokenSupplierUserPayload struct {
|
||||
Token string `json:"token"`
|
||||
Permissions []string `json:"permissions"`
|
||||
}
|
||||
|
|
|
@ -39,3 +39,16 @@ type CreateStaffResponse struct {
|
|||
type ResetPasswordResponse struct {
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// ResponseCheckTokenSupplierUser ...
|
||||
type ResponseCheckTokenSupplierUser struct {
|
||||
IsValid bool `json:"isValid"`
|
||||
Reason string `json:"reason"`
|
||||
User ResponseSupplierUserInfo `json:"supplier"`
|
||||
}
|
||||
|
||||
type ResponseSupplierUserInfo struct {
|
||||
ID string `json:"_id"`
|
||||
Name string `json:"name"`
|
||||
SupplierID string `json:"supplierId"`
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ var Supplier = struct {
|
|||
GetFreeShipInfo string
|
||||
FindAllOld string
|
||||
Count string
|
||||
CheckTokenSupplier string
|
||||
}{
|
||||
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
||||
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
||||
|
@ -31,5 +30,4 @@ var Supplier = struct {
|
|||
GetFreeShipInfo: getSupplierValue("get_free_ship_info"),
|
||||
FindAllOld: getSupplierValue("find_all_old"),
|
||||
Count: getSupplierValue("count"),
|
||||
CheckTokenSupplier: getSupplierValue("check_token_supplier"),
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ var SupplierUser = struct {
|
|||
UpdateStatus string
|
||||
ResetPassword string
|
||||
ChangePassword string
|
||||
CheckToken string
|
||||
}{
|
||||
// Users
|
||||
LoginUser: getSupplierUserValue("login_user"),
|
||||
|
@ -32,4 +33,5 @@ var SupplierUser = struct {
|
|||
UpdateStatus: getSupplierUserValue("update_status"),
|
||||
ResetPassword: getSupplierUserValue("reset_password"),
|
||||
ChangePassword: getSupplierUserValue("change_password"),
|
||||
CheckToken: getSupplierUserValue("check_token"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue