Compare commits
	
		
			23 Commits
		
	
	
		
			master
			...
			feature/ge
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | b45fb1d19a | |
|  | 040c867c15 | |
|  | 5c3c5b6dcb | |
|  | ae16428783 | |
|  | 0d3c931c87 | |
|  | aeec881299 | |
|  | b345cd5395 | |
|  | 9407b2df6b | |
|  | 49426e322c | |
|  | ac1ec030db | |
|  | 816316b558 | |
|  | 55e3c07cf6 | |
|  | 868df4713d | |
|  | e26762916c | |
|  | 19349b9813 | |
|  | 285ddb75e7 | |
|  | 56d210bf2d | |
|  | 0d8e3969db | |
|  | 64ad17016c | |
|  | f6a2b34a7f | |
|  | 708fad7c59 | |
|  | 97686ff405 | |
|  | 20f460b4ef | 
|  | @ -0,0 +1,31 @@ | |||
| package client | ||||
| 
 | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 
 | ||||
| 	"git.selly.red/Selly-Modules/natsio" | ||||
| 	"git.selly.red/Selly-Modules/natsio/model" | ||||
| 	"git.selly.red/Selly-Modules/natsio/subject" | ||||
| ) | ||||
| 
 | ||||
| func GetNotification() Notification { | ||||
| 	return Notification{} | ||||
| } | ||||
| 
 | ||||
| type Notification struct{} | ||||
| 
 | ||||
| func (n Notification) SupplierChangeBalanceRequestApproved(p model.NotificationSupplierChangeBalanceRequestApprovedReq) error { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Notification.SupplierChangeBalanceRequestApproved, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	var r model.CommonResponseData | ||||
| 	if err = json.Unmarshal(msg.Data, &r); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	if r.Error != "" { | ||||
| 		return errors.New(r.Error) | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | @ -119,3 +119,24 @@ func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrd | |||
| 	} | ||||
| 	return &r.Data, nil | ||||
| } | ||||
| 
 | ||||
| // GetSupplierCash ...
 | ||||
| func (o Order) GetSupplierCash(p model.OrderSupplierCashReq) (*model.OrderSupplierCashRes, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Order.GetSupplierCash, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	var ( | ||||
| 		r struct { | ||||
| 			Data  model.OrderSupplierCashRes `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 | ||||
| } | ||||
|  |  | |||
|  | @ -101,9 +101,9 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod | |||
| 	return r.Data, nil | ||||
| } | ||||
| 
 | ||||
| // CreateWarehouseIntoServiceSupplier ...
 | ||||
| func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehousePayload) error { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, toBytes(p)) | ||||
| // SyncWarehouseIntoServiceSupplier ...
 | ||||
| func (s Supplier) SyncWarehouseIntoServiceSupplier(p model.SyncSupplierWarehousePayload) error { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Warehouse.SyncWarehouseIntoServiceSupplier, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | @ -119,9 +119,63 @@ func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWareh | |||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| // UpdateWarehouseIntoServiceSupplier ...
 | ||||
| func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWarehousePayload) error { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseIntoServiceSupplier, toBytes(p)) | ||||
| // CreateCashflow ...
 | ||||
| func (s Supplier) CreateCashflow(p model.SupplierCashflowCreatePayload) (*model.SupplierCashflowCreateResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Supplier.CreateCashflow, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	var r struct { | ||||
| 		Error string                                `json:"error"` | ||||
| 		Data  *model.SupplierCashflowCreateResponse `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 | ||||
| } | ||||
| 
 | ||||
| func (s Supplier) UpdateBalance(p model.SupplierUpdateBalanceReq) (*model.SupplierUpdateBalanceRes, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Supplier.UpdateBalance, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	var r struct { | ||||
| 		Error string                          `json:"error"` | ||||
| 		Data  *model.SupplierUpdateBalanceRes `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 | ||||
| } | ||||
| 
 | ||||
| func (s Supplier) GetCurrentBalance(p model.SupplierGetCurrentBalanceReq) (*model.SupplierGetCurrentBalanceRes, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Supplier.GetCurrentBalance, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	var r struct { | ||||
| 		Error string                              `json:"error"` | ||||
| 		Data  *model.SupplierGetCurrentBalanceRes `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 | ||||
| } | ||||
| 
 | ||||
| func (s Supplier) DeleteCashflow(p model.SupplierDeleteCashflowReq) error { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Supplier.DeleteCashflow, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  |  | |||
|  | @ -0,0 +1,79 @@ | |||
| package client | ||||
| 
 | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 	"git.selly.red/Selly-Modules/natsio" | ||||
| 	"git.selly.red/Selly-Modules/natsio/model" | ||||
| 	"git.selly.red/Selly-Modules/natsio/subject" | ||||
| ) | ||||
| 
 | ||||
| // SupplierPermission ...
 | ||||
| type SupplierPermission struct{} | ||||
| 
 | ||||
| // GetSupplierPermission ...
 | ||||
| func GetSupplierPermission() SupplierPermission { | ||||
| 	return SupplierPermission{} | ||||
| } | ||||
| 
 | ||||
| func (s SupplierPermission) GetListPermission(p model.GetListPermissionRequest) (*model.GetListPermissionResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierPermission.GetList, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	var r struct { | ||||
| 		Data  *model.GetListPermissionResponse `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 SupplierPermission) CreatePermission(p model.CreatePermissionRequest) (*model.CreatePermissionResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierPermission.Create, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	var r struct { | ||||
| 		Data  *model.CreatePermissionResponse `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 SupplierPermission) UpdatePermission(p model.UpdatePermissionRequest) error { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierPermission.Update, 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 | ||||
| } | ||||
|  | @ -16,8 +16,28 @@ func GetSupplierRole() SupplierRole { | |||
| 	return SupplierRole{} | ||||
| } | ||||
| 
 | ||||
| func (s SupplierRole) GetListRole(p model.GetListRoleRequest) (*model.GetListRoleResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierRole.GetList, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	var r struct { | ||||
| 		Data  *model.GetListRoleResponse `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 SupplierRole) CreateRole(p model.CreateRoleRequest) (*model.CreateRoleResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p)) | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierRole.Create, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | @ -56,3 +76,24 @@ func (s SupplierRole) UpdateRole(p model.UpdateRoleRequest) error { | |||
| 
 | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| func (s SupplierRole) DetailRole(p model.DetailRoleRequest) (*model.RoleBrief, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierRole.Detail, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	var r struct { | ||||
| 		Data  *model.RoleBrief `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 | ||||
| } | ||||
|  |  | |||
|  | @ -16,6 +16,48 @@ func GetSupplierUser() SupplierUser { | |||
| 	return SupplierUser{} | ||||
| } | ||||
| 
 | ||||
| func (s SupplierUser) LoginUser(p model.LoginUserRequest) (*model.LoginUserResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierUser.LoginUser, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	var r struct { | ||||
| 		Data  *model.LoginUserResponse `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) 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.GetListUserResponse `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) CreateSupplierOwnerUsers(p model.CreateOwnerRequest) (*model.CreateOwnerResponse, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p)) | ||||
| 	if err != nil { | ||||
|  | @ -99,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 | ||||
| 	} | ||||
|  |  | |||
|  | @ -0,0 +1,39 @@ | |||
| package client | ||||
| 
 | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 
 | ||||
| 	"git.selly.red/Selly-Modules/natsio" | ||||
| 	"git.selly.red/Selly-Modules/natsio/model" | ||||
| 	"git.selly.red/Selly-Modules/natsio/subject" | ||||
| ) | ||||
| 
 | ||||
| // Withdraw ...
 | ||||
| type Withdraw struct{} | ||||
| 
 | ||||
| // GetWithdraw ...
 | ||||
| func GetWithdraw() Withdraw { | ||||
| 	return Withdraw{} | ||||
| } | ||||
| 
 | ||||
| // GetSupplierCash ...
 | ||||
| func (o Withdraw) GetSupplierCash(p model.WithdrawSupplierCashReq) (*model.WithdrawSupplierCashRes, error) { | ||||
| 	msg, err := natsio.GetServer().Request(subject.Withdraw.GetSupplierCash, toBytes(p)) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	var ( | ||||
| 		r struct { | ||||
| 			Data  model.WithdrawSupplierCashRes `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 | ||||
| } | ||||
|  | @ -20,3 +20,9 @@ type ActionBy struct { | |||
| 	ID   string `json:"id"` | ||||
| 	Name string `json:"name"` | ||||
| } | ||||
| 
 | ||||
| // ClickAction ...
 | ||||
| type ClickAction struct { | ||||
| 	Type  string `json:"type"` | ||||
| 	Value string `json:"value"` | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,7 @@ | |||
| package model | ||||
| 
 | ||||
| type NotificationSupplierChangeBalanceRequestApprovedReq struct { | ||||
| 	SupplierID string  `json:"supplierId"` | ||||
| 	Cash       float64 `json:"cash"` | ||||
| 	Reason     string  `json:"reason"` | ||||
| } | ||||
|  | @ -0,0 +1 @@ | |||
| package model | ||||
|  | @ -49,3 +49,7 @@ type OrderSupplierQuery struct { | |||
| 	SupplierID   string   `json:"supplierId"` | ||||
| 	WarehouseIDs []string `json:"warehouseIDs"` | ||||
| } | ||||
| 
 | ||||
| type OrderSupplierCashReq struct { | ||||
| 	SupplierID string `json:"supplierId"` | ||||
| } | ||||
|  |  | |||
|  | @ -33,3 +33,9 @@ type SupplierOrderDelivery struct { | |||
| 	Status  string `json:"status" enums:"waiting_to_confirm,waiting_to_pick,picking,picked,delay_pickup,pickup_failed,delivering,delay_delivery,delivered,cancelled,delivery_failed,waiting_to_return,returning,delay_return,compensation,returned"` | ||||
| 	TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"` | ||||
| } | ||||
| 
 | ||||
| type OrderSupplierCashRes struct { | ||||
| 	PendingCash             float64 `json:"pendingCash"` | ||||
| 	WaitingForReconcileCash float64 `json:"waitingForReconcileCash"` | ||||
| 	ReconciledCash          float64 `json:"reconciledCash"` | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1 @@ | |||
| package model | ||||
|  | @ -0,0 +1 @@ | |||
| package model | ||||
|  | @ -0,0 +1,24 @@ | |||
| package model | ||||
| 
 | ||||
| type GetListPermissionRequest struct { | ||||
| 	Page  int    `json:"page"` | ||||
| 	Limit int    `json:"limit"` | ||||
| 	Group string `json:"group"` | ||||
| } | ||||
| 
 | ||||
| type DetailPermissionRequest struct { | ||||
| 	ID string `json:"_id"` | ||||
| } | ||||
| 
 | ||||
| type CreatePermissionRequest struct { | ||||
| 	Name  string `json:"name"` | ||||
| 	Code  string `json:"code"` | ||||
| 	Group string `json:"group"` | ||||
| } | ||||
| 
 | ||||
| type UpdatePermissionRequest struct { | ||||
| 	ID    string `json:"_id"` | ||||
| 	Name  string `json:"name"` | ||||
| 	Code  string `json:"code"` | ||||
| 	Group string `json:"group"` | ||||
| } | ||||
|  | @ -0,0 +1,26 @@ | |||
| package model | ||||
| 
 | ||||
| type GetListPermissionResponse struct { | ||||
| 	Permissions []PermissionBrief `json:"permissions"` | ||||
| 	Total       int64             `json:"total"` | ||||
| } | ||||
| 
 | ||||
| type PermissionBrief struct { | ||||
| 	ID        string `json:"_id"` | ||||
| 	Name      string `json:"name"` | ||||
| 	Code      string `json:"code"` | ||||
| 	Group     string `json:"group"` | ||||
| 	CreatedAt string `json:"createdAt"` | ||||
| 	UpdatedAt string `json:"updatedAt"` | ||||
| } | ||||
| 
 | ||||
| type CreatePermissionResponse struct { | ||||
| 	ID string `json:"_id"` | ||||
| } | ||||
| 
 | ||||
| type PermissionShort struct { | ||||
| 	ID    string `json:"_id"` | ||||
| 	Name  string `json:"name"` | ||||
| 	Code  string `json:"code"` | ||||
| 	Group string `json:"group"` | ||||
| } | ||||
|  | @ -23,18 +23,24 @@ type SupplierRequestPayload struct { | |||
| 	ContractStatus string | ||||
| } | ||||
| 
 | ||||
| type CreateSupplierWarehousePayload struct { | ||||
| 	Supplier     string `json:"supplier"` | ||||
| 	Warehouse    string `json:"warehouse"` | ||||
| 	ProvinceCode int    `json:"provinceCode"` | ||||
| 	DistrictCode int    `json:"districtCode"` | ||||
| 	WardCode     int    `json:"wardCode"` | ||||
| // SupplierCashflowCreatePayload ...
 | ||||
| type SupplierCashflowCreatePayload struct { | ||||
| 	Supplier    string       `json:"supplier"` | ||||
| 	Action      string       `json:"action"` | ||||
| 	Name        string       `json:"name"` | ||||
| 	TargetID    string       `json:"targetId"` | ||||
| 	Value       float64      `json:"value"` | ||||
| 	ClickAction *ClickAction `json:"clickAction"` | ||||
| } | ||||
| 
 | ||||
| type UpdateSupplierWarehousePayload struct { | ||||
| 	Supplier     string `json:"supplier"` | ||||
| 	Warehouse    string `json:"warehouse"` | ||||
| 	ProvinceCode int    `json:"provinceCode"` | ||||
| 	DistrictCode int    `json:"districtCode"` | ||||
| 	WardCode     int    `json:"wardCode"` | ||||
| type SupplierUpdateBalanceReq struct { | ||||
| 	SupplierID string `json:"supplierId"` | ||||
| } | ||||
| 
 | ||||
| type SupplierGetCurrentBalanceReq struct { | ||||
| 	SupplierID string `json:"supplierId"` | ||||
| } | ||||
| 
 | ||||
| type SupplierDeleteCashflowReq struct { | ||||
| 	CashflowID string `json:"cashflowId"` | ||||
| } | ||||
|  |  | |||
|  | @ -29,3 +29,38 @@ type SupplierAll struct { | |||
| 	Suppliers []SupplierBrief `json:"suppliers"` | ||||
| 	Total     int64           `json:"total"` | ||||
| } | ||||
| 
 | ||||
| type SupplierCashflowCreateResponse struct { | ||||
| 	ID string `json:"id"` | ||||
| } | ||||
| 
 | ||||
| type SupplierShort struct { | ||||
| 	ID   string      `json:"_id"` | ||||
| 	Name string      `json:"name"` | ||||
| 	Logo interface{} `json:"logo"` | ||||
| } | ||||
| 
 | ||||
| type SupplierUpdateBalanceRes struct { | ||||
| 	CurrentCash                  float64 `json:"currentCash"` | ||||
| 	TotalPendingCash             float64 `json:"totalPendingCash"` | ||||
| 	OrderPendingCash             float64 `json:"orderPendingCash"` | ||||
| 	OrderWaitingForReconcileCash float64 `json:"orderWaitingForReconcileCash"` | ||||
| 	OrderReconciledCash          float64 `json:"orderReconciledCash"` | ||||
| 	WithdrawPendingCash          float64 `json:"withdrawPendingCash"` | ||||
| 	WithdrawSuccessCash          float64 `json:"withdrawSuccessCash"` | ||||
| 	WithdrawRejectCash           float64 `json:"withdrawRejectCash"` | ||||
| 	ChangeBalanceRequestApproved float64 `json:"changeBalanceRequestApproved"` | ||||
| 	UpdatedAt                    string  `json:"updatedAt"` | ||||
| } | ||||
| 
 | ||||
| type SupplierGetCurrentBalanceRes struct { | ||||
| 	CurrentCash float64 `json:"currentCash"` | ||||
| } | ||||
| 
 | ||||
| type SyncSupplierWarehousePayload struct { | ||||
| 	Supplier     string `json:"supplier"` | ||||
| 	Warehouse    string `json:"warehouse"` | ||||
| 	ProvinceCode int    `json:"provinceCode"` | ||||
| 	DistrictCode int    `json:"districtCode"` | ||||
| 	WardCode     int    `json:"wardCode"` | ||||
| } | ||||
|  |  | |||
|  | @ -1,14 +1,29 @@ | |||
| package model | ||||
| 
 | ||||
| type GetListRoleRequest struct { | ||||
| 	Page       int    `json:"page"` | ||||
| 	Limit      int    `json:"limit"` | ||||
| 	Type       string `json:"type"` | ||||
| 	SupplierID string `json:"supplierId"` | ||||
| } | ||||
| 
 | ||||
| type DetailRoleRequest struct { | ||||
| 	ID string `json:"_id"` | ||||
| } | ||||
| 
 | ||||
| type CreateRoleRequest struct { | ||||
| 	Name string `json:"name"` | ||||
| 	Code string `json:"code"` | ||||
| 	Type string `json:"type"` | ||||
| 	Name        string   `json:"name"` | ||||
| 	Code        string   `json:"code"` | ||||
| 	Type        string   `json:"type"` | ||||
| 	SupplierID  string   `json:"supplierId"` | ||||
| 	Permissions []string `json:"permissions"` | ||||
| } | ||||
| 
 | ||||
| type UpdateRoleRequest struct { | ||||
| 	ID   string `json:"_id"` | ||||
| 	Name string `json:"name"` | ||||
| 	Code string `json:"code"` | ||||
| 	Type string `json:"type"` | ||||
| 	ID          string   `json:"_id"` | ||||
| 	Name        string   `json:"name"` | ||||
| 	Code        string   `json:"code"` | ||||
| 	Type        string   `json:"type"` | ||||
| 	SupplierID  string   `json:"supplierId"` | ||||
| 	Permissions []string `json:"permissions"` | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,29 @@ | |||
| package model | ||||
| 
 | ||||
| type GetListRoleResponse struct { | ||||
| 	Roles []RoleBrief `json:"roles"` | ||||
| 	Total int64       `json:"total"` | ||||
| } | ||||
| 
 | ||||
| type RoleBrief struct { | ||||
| 	ID          string            `json:"_id"` | ||||
| 	Name        string            `json:"name"` | ||||
| 	Code        string            `json:"code"` | ||||
| 	Type        string            `json:"type"` | ||||
| 	Permissions []PermissionShort `json:"permissions"` | ||||
| 	SupplierId  string            `json:"supplierId"` | ||||
| 	CreatedAt   string            `json:"createdAt"` | ||||
| 	UpdatedAt   string            `json:"updatedAt"` | ||||
| } | ||||
| 
 | ||||
| type CreateRoleResponse struct { | ||||
| 	ID string `json:"_id"` | ||||
| } | ||||
| 
 | ||||
| type RoleShort struct { | ||||
| 	ID         string `json:"_id"` | ||||
| 	Name       string `json:"name"` | ||||
| 	Code       string `json:"code"` | ||||
| 	Type       string `json:"type"` | ||||
| 	SupplierId string `json:"supplierId"` | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,30 @@ | |||
| package model | ||||
| 
 | ||||
| type LoginUserRequest struct { | ||||
| 	Email        string `json:"email"` | ||||
| 	Password     string `json:"password"` | ||||
| 	DeviceID     string `json:"deviceId"` | ||||
| 	AppVersion   string `json:"appVersion"` | ||||
| 	UserAgent    string `json:"userAgent"` | ||||
| 	Model        string `json:"model"` | ||||
| 	Manufacturer string `json:"manufacturer"` | ||||
| 	IP           string `json:"ip"` | ||||
| 	Language     string `json:"language"` | ||||
| 	FCMToken     string `json:"FCMToken"` | ||||
| 	AuthToken    string `json:"authToken"` | ||||
| 	OsName       string `json:"osName"` | ||||
| 	OsVersion    string `json:"osVersion"` | ||||
| 	IsMobile     bool   `json:"isMobile"` | ||||
| } | ||||
| 
 | ||||
| type GetListUserRequest struct { | ||||
| 	Page       int    `json:"page"` | ||||
| 	Limit      int    `json:"limit"` | ||||
| 	Status     string `json:"status"` | ||||
| 	Type       string `json:"type"` | ||||
| 	SupplierID string `json:"supplierId"` | ||||
| } | ||||
| 
 | ||||
| type CreateOwnerRequest struct { | ||||
| 	Name       string `json:"name"` | ||||
| 	Phone      string `json:"phone"` | ||||
|  | @ -46,6 +71,5 @@ type UpdateStatusRequest struct { | |||
| } | ||||
| 
 | ||||
| type ResetPasswordRequest struct { | ||||
| 	ID       string `json:"_id"` | ||||
| 	Password string `json:"password"` | ||||
| 	ID string `json:"_id"` | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,31 @@ | |||
| package model | ||||
| 
 | ||||
| // LoginUserResponse ...
 | ||||
| type LoginUserResponse struct { | ||||
| 	ID                      string `json:"_id"` | ||||
| 	RequireToChangePassword bool   `json:"requireToChangePassword"` | ||||
| 	SupplierID              string `json:"supplierId"` | ||||
| } | ||||
| 
 | ||||
| type GetListUserResponse struct { | ||||
| 	SupplierUsers []SupplierUserBrief `json:"supplierUsers"` | ||||
| 	Total         int64               `json:"total"` | ||||
| } | ||||
| 
 | ||||
| type SupplierUserBrief struct { | ||||
| 	ID         string      `json:"_id"` | ||||
| 	Role       RoleShort   `json:"role"` | ||||
| 	SupplierID string      `json:"supplierId"` | ||||
| 	Name       string      `json:"name"` | ||||
| 	Phone      string      `json:"phone"` | ||||
| 	Email      string      `json:"email"` | ||||
| 	Status     string      `json:"status"` | ||||
| 	Avatar     interface{} `json:"avatar"` | ||||
| 	Type       string      `json:"type"` | ||||
| 	CreatedAt  string      `json:"createdAt"` | ||||
| 	UpdatedAt  string      `json:"updatedAt"` | ||||
| } | ||||
| 
 | ||||
| type CreateOwnerResponse struct { | ||||
| 	ID string `json:"_id"` | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,5 @@ | |||
| package model | ||||
| 
 | ||||
| type WithdrawSupplierCashReq struct { | ||||
| 	SupplierID string `json:"supplierId"` | ||||
| } | ||||
|  | @ -0,0 +1,7 @@ | |||
| package model | ||||
| 
 | ||||
| type WithdrawSupplierCashRes struct { | ||||
| 	PendingCash float64 `json:"pendingCash"` | ||||
| 	SuccessCash float64 `json:"successCash"` | ||||
| 	RejectCash  float64 `json:"rejectCash"` | ||||
| } | ||||
|  | @ -1,25 +1,31 @@ | |||
| package subject | ||||
| 
 | ||||
| var prefixes = struct { | ||||
| 	Communication string | ||||
| 	Order         string | ||||
| 	News          string | ||||
| 	Warehouse     string | ||||
| 	Location      string | ||||
| 	Bank          string | ||||
| 	Supplier      string | ||||
| 	Seller        string | ||||
| 	SupplierUser  string | ||||
| 	SupplierRole  string | ||||
| 	Communication      string | ||||
| 	Order              string | ||||
| 	News               string | ||||
| 	Warehouse          string | ||||
| 	Location           string | ||||
| 	Bank               string | ||||
| 	Supplier           string | ||||
| 	Notification       string | ||||
| 	Seller             string | ||||
| 	SupplierUser       string | ||||
| 	SupplierRole       string | ||||
| 	Withdraw           string | ||||
| 	SupplierPermission string | ||||
| }{ | ||||
| 	Communication: "communication", | ||||
| 	Order:         "order", | ||||
| 	News:          "news", | ||||
| 	Warehouse:     "warehouse", | ||||
| 	Location:      "location", | ||||
| 	Supplier:      "supplier", | ||||
| 	Bank:          "bank", | ||||
| 	Seller:        "seller", | ||||
| 	SupplierUser:  "supplier_user", | ||||
| 	SupplierRole:  "supplier_role", | ||||
| 	Communication:      "communication", | ||||
| 	Order:              "order", | ||||
| 	News:               "news", | ||||
| 	Warehouse:          "warehouse", | ||||
| 	Location:           "location", | ||||
| 	Supplier:           "supplier", | ||||
| 	Notification:       "notification", | ||||
| 	Bank:               "bank", | ||||
| 	Seller:             "seller", | ||||
| 	SupplierUser:       "supplier_user", | ||||
| 	SupplierRole:       "supplier_role", | ||||
| 	Withdraw:           "withdraw", | ||||
| 	SupplierPermission: "supplier_permission", | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,13 @@ | |||
| package subject | ||||
| 
 | ||||
| import "fmt" | ||||
| 
 | ||||
| func getNotificationValue(val string) string { | ||||
| 	return fmt.Sprintf("%s.%s", prefixes.Notification, val) | ||||
| } | ||||
| 
 | ||||
| var Notification = struct { | ||||
| 	SupplierChangeBalanceRequestApproved string | ||||
| }{ | ||||
| 	SupplierChangeBalanceRequestApproved: getNotificationValue("supplier_change_balance_request_approved"), | ||||
| } | ||||
|  | @ -13,6 +13,7 @@ var Order = struct { | |||
| 	UpdateLogisticInfoFailed string | ||||
| 	ORNotUpdateStatus        string | ||||
| 	GetSupplierOrders        string | ||||
| 	GetSupplierCash          string | ||||
| }{ | ||||
| 	UpdateORStatus:           getOrderValue("update_outbound_request_status"), | ||||
| 	CancelDelivery:           getOrderValue("cancel_delivery"), | ||||
|  | @ -20,4 +21,5 @@ var Order = struct { | |||
| 	UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"), | ||||
| 	ORNotUpdateStatus:        getOrderValue("outbound_request_not_update_status"), | ||||
| 	GetSupplierOrders:        getOrderValue("get_supplier_orders"), | ||||
| 	GetSupplierCash:          getOrderValue("get_supplier_cash"), | ||||
| } | ||||
|  |  | |||
|  | @ -10,8 +10,16 @@ var Supplier = struct { | |||
| 	GetListSupplierInfo             string | ||||
| 	GetSupplierContractBySupplierID string | ||||
| 	FindAll                         string | ||||
| 	CreateCashflow                  string | ||||
| 	DeleteCashflow                  string | ||||
| 	UpdateBalance                   string | ||||
| 	GetCurrentBalance               string | ||||
| }{ | ||||
| 	GetListSupplierInfo:             getSupplierValue("get_list_supplier_info"), | ||||
| 	GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"), | ||||
| 	FindAll:                         getSupplierValue("find_all"), | ||||
| 	CreateCashflow:                  getSupplierValue("create_cashflow"), | ||||
| 	DeleteCashflow:                  getSupplierValue("delete_cashflow"), | ||||
| 	UpdateBalance:                   getSupplierValue("update_balance"), | ||||
| 	GetCurrentBalance:               getSupplierValue("get_current_balance"), | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,17 @@ | |||
| package subject | ||||
| 
 | ||||
| import "fmt" | ||||
| 
 | ||||
| func getPermissionValue(val string) string { | ||||
| 	return fmt.Sprintf("%s.%s", prefixes.SupplierPermission, val) | ||||
| } | ||||
| 
 | ||||
| var SupplierPermission = struct { | ||||
| 	GetList string | ||||
| 	Create  string | ||||
| 	Update  string | ||||
| }{ | ||||
| 	GetList: getPermissionValue("get_list"), | ||||
| 	Create:  getPermissionValue("create"), | ||||
| 	Update:  getPermissionValue("update"), | ||||
| } | ||||
|  | @ -7,9 +7,15 @@ func getRoleValue(val string) string { | |||
| } | ||||
| 
 | ||||
| var SupplierRole = struct { | ||||
| 	Create string | ||||
| 	Update string | ||||
| 	GetList             string | ||||
| 	Detail              string | ||||
| 	Create              string | ||||
| 	Update              string | ||||
| 	GetListBySupplierID string | ||||
| }{ | ||||
| 	Create: getRoleValue("create"), | ||||
| 	Update: getRoleValue("update"), | ||||
| 	GetList:             getRoleValue("get_list"), | ||||
| 	Detail:              getRoleValue("detail"), | ||||
| 	Create:              getRoleValue("create"), | ||||
| 	Update:              getRoleValue("update"), | ||||
| 	GetListBySupplierID: getRoleValue("get_list_by_supplierId"), | ||||
| } | ||||
|  |  | |||
|  | @ -8,6 +8,8 @@ func getSupplierUserValue(val string) string { | |||
| 
 | ||||
| var SupplierUser = struct { | ||||
| 	// Users
 | ||||
| 	LoginUser     string | ||||
| 	GetListUser   string | ||||
| 	CreateOwner   string | ||||
| 	UpdateOwner   string | ||||
| 	CreateStaff   string | ||||
|  | @ -16,6 +18,8 @@ var SupplierUser = struct { | |||
| 	ResetPassword string | ||||
| }{ | ||||
| 	// Users
 | ||||
| 	LoginUser:     getSupplierUserValue("login_user"), | ||||
| 	GetListUser:   getSupplierUserValue("get_list_user"), | ||||
| 	CreateOwner:   getSupplierUserValue("create_owner"), | ||||
| 	UpdateOwner:   getSupplierUserValue("update_owner"), | ||||
| 	CreateStaff:   getSupplierUserValue("create_staff"), | ||||
|  |  | |||
|  | @ -7,43 +7,41 @@ func getWarehouseValue(val string) string { | |||
| } | ||||
| 
 | ||||
| var Warehouse = struct { | ||||
| 	CreateWarehouseIntoServiceSupplier string | ||||
| 	UpdateWarehouseIntoServiceSupplier string | ||||
| 	CreateOutboundRequest              string | ||||
| 	UpdateOutboundRequestLogistic      string | ||||
| 	CancelOutboundRequest              string | ||||
| 	GetConfiguration                   string | ||||
| 	SyncORStatus                       string | ||||
| 	WebhookTNC                         string | ||||
| 	WebhookGlobalCare                  string | ||||
| 	WebhookOnPoint                     string | ||||
| 	FindOne                            string | ||||
| 	FindByCondition                    string | ||||
| 	Distinct                           string | ||||
| 	Count                              string | ||||
| 	AfterUpdateWarehouse               string | ||||
| 	AfterCreateWarehouse               string | ||||
| 	UpdateIsClosedSupplier             string | ||||
| 	GetWarehouses                      string | ||||
| 	UpdateORDeliveryStatus             string | ||||
| 	SyncWarehouseIntoServiceSupplier string | ||||
| 	CreateOutboundRequest            string | ||||
| 	UpdateOutboundRequestLogistic    string | ||||
| 	CancelOutboundRequest            string | ||||
| 	GetConfiguration                 string | ||||
| 	SyncORStatus                     string | ||||
| 	WebhookTNC                       string | ||||
| 	WebhookGlobalCare                string | ||||
| 	WebhookOnPoint                   string | ||||
| 	FindOne                          string | ||||
| 	FindByCondition                  string | ||||
| 	Distinct                         string | ||||
| 	Count                            string | ||||
| 	AfterUpdateWarehouse             string | ||||
| 	AfterCreateWarehouse             string | ||||
| 	UpdateIsClosedSupplier           string | ||||
| 	GetWarehouses                    string | ||||
| 	UpdateORDeliveryStatus           string | ||||
| }{ | ||||
| 	CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), | ||||
| 	UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"), | ||||
| 	AfterCreateWarehouse:               getWarehouseValue("after_create_warehouse"), | ||||
| 	AfterUpdateWarehouse:               getWarehouseValue("after_update_warehouse"), | ||||
| 	CreateOutboundRequest:              getWarehouseValue("create_outbound_request"), | ||||
| 	UpdateOutboundRequestLogistic:      getWarehouseValue("update_outbound_request_logistic_info"), | ||||
| 	CancelOutboundRequest:              getWarehouseValue("cancel_outbound_request"), | ||||
| 	GetConfiguration:                   getWarehouseValue("get_configuration"), | ||||
| 	SyncORStatus:                       getWarehouseValue("sync_or_status"), | ||||
| 	WebhookTNC:                         getWarehouseValue("webhook_tnc"), | ||||
| 	WebhookGlobalCare:                  getWarehouseValue("webhook_global_care"), | ||||
| 	WebhookOnPoint:                     getWarehouseValue("webhook_on_point"), | ||||
| 	FindOne:                            getWarehouseValue("find_one"), | ||||
| 	FindByCondition:                    getWarehouseValue("find_all_by_condition"), | ||||
| 	Distinct:                           getWarehouseValue("distinct"), | ||||
| 	Count:                              getWarehouseValue("count"), | ||||
| 	UpdateIsClosedSupplier:             getWarehouseValue("update_is_closed_supplier"), | ||||
| 	GetWarehouses:                      getWarehouseValue("get_warehouses"), | ||||
| 	UpdateORDeliveryStatus:             getWarehouseValue("update_or_delivery_status"), | ||||
| 	SyncWarehouseIntoServiceSupplier: getWarehouseValue("sync_warehouse_into_service_supplier"), | ||||
| 	AfterCreateWarehouse:             getWarehouseValue("after_create_warehouse"), | ||||
| 	AfterUpdateWarehouse:             getWarehouseValue("after_update_warehouse"), | ||||
| 	CreateOutboundRequest:            getWarehouseValue("create_outbound_request"), | ||||
| 	UpdateOutboundRequestLogistic:    getWarehouseValue("update_outbound_request_logistic_info"), | ||||
| 	CancelOutboundRequest:            getWarehouseValue("cancel_outbound_request"), | ||||
| 	GetConfiguration:                 getWarehouseValue("get_configuration"), | ||||
| 	SyncORStatus:                     getWarehouseValue("sync_or_status"), | ||||
| 	WebhookTNC:                       getWarehouseValue("webhook_tnc"), | ||||
| 	WebhookGlobalCare:                getWarehouseValue("webhook_global_care"), | ||||
| 	WebhookOnPoint:                   getWarehouseValue("webhook_on_point"), | ||||
| 	FindOne:                          getWarehouseValue("find_one"), | ||||
| 	FindByCondition:                  getWarehouseValue("find_all_by_condition"), | ||||
| 	Distinct:                         getWarehouseValue("distinct"), | ||||
| 	Count:                            getWarehouseValue("count"), | ||||
| 	UpdateIsClosedSupplier:           getWarehouseValue("update_is_closed_supplier"), | ||||
| 	GetWarehouses:                    getWarehouseValue("get_warehouses"), | ||||
| 	UpdateORDeliveryStatus:           getWarehouseValue("update_or_delivery_status"), | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,13 @@ | |||
| package subject | ||||
| 
 | ||||
| import "fmt" | ||||
| 
 | ||||
| func getWithdrawValue(val string) string { | ||||
| 	return fmt.Sprintf("%s.%s", prefixes.Withdraw, val) | ||||
| } | ||||
| 
 | ||||
| var Withdraw = struct { | ||||
| 	GetSupplierCash string | ||||
| }{ | ||||
| 	GetSupplierCash: getWithdrawValue("get_supplier_cash"), | ||||
| } | ||||
		Loading…
	
		Reference in New Issue