nats-location-supplier #6
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -18,7 +18,7 @@ func GetLocation() Location {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func (l Location) GetLocationByCode(payload model.LocationRequestPayload) (*model.ResponseLocationAddress, error) {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.GetLocationWarehouse, toBytes(payload))
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Location.GetLocationByCode, toBytes(payload))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ import (
 | 
			
		|||
type Supplier struct{}
 | 
			
		||||
 | 
			
		||||
func (s Supplier) GetSupplierInfo(supplierID string) (*model.ResponseSupplierInfo, error) {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.GetSupplierInfo, toBytes(supplierID))
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Supplier.GetSupplierInfo, toBytes(supplierID))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,8 +4,12 @@ var prefixes = struct {
 | 
			
		|||
	Communication string
 | 
			
		||||
	Order         string
 | 
			
		||||
	Warehouse     string
 | 
			
		||||
	Location      string
 | 
			
		||||
	Supplier      string
 | 
			
		||||
}{
 | 
			
		||||
	Communication: "communication",
 | 
			
		||||
	Order:         "order",
 | 
			
		||||
	Warehouse:     "warehouse",
 | 
			
		||||
	Location:      "location",
 | 
			
		||||
	Supplier:      "supplier",
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,13 @@
 | 
			
		|||
package subject
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	locationPrefix = "location_"
 | 
			
		||||
)
 | 
			
		||||
const (
 | 
			
		||||
	GetLocationWarehouse = locationPrefix + "get_address"
 | 
			
		||||
)
 | 
			
		||||
import "fmt"
 | 
			
		||||
 | 
			
		||||
func getLocationValue(val string) string {
 | 
			
		||||
	return fmt.Sprintf("%s.%s", prefixes.Location, val)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var Location = struct {
 | 
			
		||||
	GetLocationByCode string
 | 
			
		||||
}{
 | 
			
		||||
	GetLocationByCode: getLocationValue("get_location_warehouse"),
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,13 @@
 | 
			
		|||
package subject
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	supplierPrefix = "supplier"
 | 
			
		||||
)
 | 
			
		||||
const (
 | 
			
		||||
	GetSupplierInfo = supplierPrefix + "get_info"
 | 
			
		||||
)
 | 
			
		||||
import "fmt"
 | 
			
		||||
 | 
			
		||||
func getSupplierValue(val string) string {
 | 
			
		||||
	return fmt.Sprintf("%s.%s", prefixes.Supplier, val)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var Supplier = struct {
 | 
			
		||||
	GetSupplierInfo string
 | 
			
		||||
}{
 | 
			
		||||
	GetSupplierInfo: getSupplierValue("get_supplier_info"),
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue