fix conflict

This commit is contained in:
buiphuan0211 2022-12-29 13:51:37 +07:00
commit f09f9412fd
8 changed files with 41 additions and 35 deletions

View File

@ -274,23 +274,3 @@ func (s Supplier) DeleteCashflow(p model.SupplierDeleteCashflowReq) error {
} }
return nil 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
}

View File

@ -241,3 +241,23 @@ func (s SupplierUser) ChangePassword(p model.ChangePasswordRequest) error {
return nil 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
}

View File

@ -62,9 +62,3 @@ type SupplierCountReq struct {
IDs []string `json:"ids"` IDs []string `json:"ids"`
Status string `json:"status"` // active,inactive Status string `json:"status"` // active,inactive
} }
// CheckTokenSupplierPayload ...
type CheckTokenSupplierPayload struct {
Token string `json:"token"`
Permissions []string `json:"permissions"`
}

View File

@ -84,10 +84,3 @@ type SyncSupplierWarehousePayload struct {
type SupplierCountRes struct { type SupplierCountRes struct {
Total int64 `json:"total"` Total int64 `json:"total"`
} }
// ResponseCheckTokenSupplier ...
type ResponseCheckTokenSupplier struct {
IsValid bool `json:"isValid"`
Reason string `json:"reason"`
Supplier ResponseSupplierInfo `json:"supplier"`
}

View File

@ -84,3 +84,9 @@ type ChangePasswordRequest struct {
ID string `json:"_id"` ID string `json:"_id"`
Password string `json:"password"` Password string `json:"password"`
} }
// CheckTokenSupplierUserPayload ...
type CheckTokenSupplierUserPayload struct {
Token string `json:"token"`
Permissions []string `json:"permissions"`
}

View File

@ -39,3 +39,16 @@ type CreateStaffResponse struct {
type ResetPasswordResponse struct { type ResetPasswordResponse struct {
Password string `json:"password"` 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"`
}

View File

@ -18,7 +18,6 @@ var Supplier = struct {
GetFreeShipInfo string GetFreeShipInfo string
FindAllOld string FindAllOld string
Count string Count string
CheckTokenSupplier string
}{ }{
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"), GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"), GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
@ -31,5 +30,4 @@ var Supplier = struct {
GetFreeShipInfo: getSupplierValue("get_free_ship_info"), GetFreeShipInfo: getSupplierValue("get_free_ship_info"),
FindAllOld: getSupplierValue("find_all_old"), FindAllOld: getSupplierValue("find_all_old"),
Count: getSupplierValue("count"), Count: getSupplierValue("count"),
CheckTokenSupplier: getSupplierValue("check_token_supplier"),
} }

View File

@ -19,6 +19,7 @@ var SupplierUser = struct {
UpdateStatus string UpdateStatus string
ResetPassword string ResetPassword string
ChangePassword string ChangePassword string
CheckToken string
}{ }{
// Users // Users
LoginUser: getSupplierUserValue("login_user"), LoginUser: getSupplierUserValue("login_user"),
@ -32,4 +33,5 @@ var SupplierUser = struct {
UpdateStatus: getSupplierUserValue("update_status"), UpdateStatus: getSupplierUserValue("update_status"),
ResetPassword: getSupplierUserValue("reset_password"), ResetPassword: getSupplierUserValue("reset_password"),
ChangePassword: getSupplierUserValue("change_password"), ChangePassword: getSupplierUserValue("change_password"),
CheckToken: getSupplierUserValue("check_token"),
} }