Merge branch 'master' of git.selly.red:Selly-Modules/natsio into fix-holiday-product
This commit is contained in:
		
						commit
						f4f15ea224
					
				| 
						 | 
					@ -19,7 +19,7 @@ func GetLocation() Location {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetLocationByCode ...
 | 
					// GetLocationByCode ...
 | 
				
			||||||
func (l Location) GetLocationByCode(payload model.LocationRequestPayload) (*model.ResponseLocationAddress, error) {
 | 
					func (l Location) GetLocationByCode(payload model.LocationRequestPayload) (*model.ResponseLocationAddress, error) {
 | 
				
			||||||
	msg, err := natsio.GetServer().Request(subject.Location.GetLocationByCode, toBytes(payload))
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetLocationByCodeFromLocationService, toBytes(payload))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ func (l Location) GetLocationByCode(payload model.LocationRequestPayload) (*mode
 | 
				
			||||||
		Data  *model.ResponseLocationAddress `json:"data"`
 | 
							Data  *model.ResponseLocationAddress `json:"data"`
 | 
				
			||||||
		Error string                         `json:"error"`
 | 
							Error string                         `json:"error"`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := json.Unmarshal(msg.Data, &r); err != nil {
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,19 +38,19 @@ func (l Location) GetLocationByCode(payload model.LocationRequestPayload) (*mode
 | 
				
			||||||
	return r.Data, nil
 | 
						return r.Data, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetProvincesByCodes ... ...
 | 
					// GetProvincesByCodes ...
 | 
				
			||||||
func (l Location) GetProvincesByCodes(p model.ProvinceRequestPayload) (*model.LocationProvinceResponse, error) {
 | 
					func (l Location) GetProvincesByCodes(p model.ProvinceRequestPayload) (*model.LocationProvinceResponse, error) {
 | 
				
			||||||
	msg, err := natsio.GetServer().Request(subject.Location.GetProvincesByCodes, toBytes(p))
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetProvincesByCodesFromLocationService, toBytes(p))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var r struct {
 | 
						var r struct {
 | 
				
			||||||
		Data  *model.LocationProvinceResponse `json:"data"'`
 | 
							Data  *model.LocationProvinceResponse `json:"data"`
 | 
				
			||||||
		Error string                          `json:"error"`
 | 
							Error string                          `json:"error"`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := json.Unmarshal(msg.Data, &r); err != nil {
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ func (l Location) GetProvincesByCodes(p model.ProvinceRequestPayload) (*model.Lo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetDistrictsByCodes ...
 | 
					// GetDistrictsByCodes ...
 | 
				
			||||||
func (l Location) GetDistrictsByCodes(p model.DistrictRequestPayload) (*model.LocationDistrictResponse, error) {
 | 
					func (l Location) GetDistrictsByCodes(p model.DistrictRequestPayload) (*model.LocationDistrictResponse, error) {
 | 
				
			||||||
	msg, err := natsio.GetServer().Request(subject.Location.GetDistrictsByCodes, toBytes(p))
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetDistrictsByCodesFromLocationService, toBytes(p))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ func (l Location) GetDistrictsByCodes(p model.DistrictRequestPayload) (*model.Lo
 | 
				
			||||||
		Error string                          `json:"error"`
 | 
							Error string                          `json:"error"`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := json.Unmarshal(msg.Data, &r); err != nil {
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ func (l Location) GetDistrictsByCodes(p model.DistrictRequestPayload) (*model.Lo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetWardsByCodes ...
 | 
					// GetWardsByCodes ...
 | 
				
			||||||
func (l Location) GetWardsByCodes(p model.WardRequestPayload) (*model.LocationWardResponse, error) {
 | 
					func (l Location) GetWardsByCodes(p model.WardRequestPayload) (*model.LocationWardResponse, error) {
 | 
				
			||||||
	msg, err := natsio.GetServer().Request(subject.Location.GetWardsByCodes, toBytes(p))
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetWardsByCodesFromLocationService, toBytes(p))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ func (l Location) GetWardsByCodes(p model.WardRequestPayload) (*model.LocationWa
 | 
				
			||||||
		Error string                      `json:"error"`
 | 
							Error string                      `json:"error"`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := json.Unmarshal(msg.Data, &r); err != nil {
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,3 +104,211 @@ func (l Location) GetWardsByCodes(p model.WardRequestPayload) (*model.LocationWa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return r.Data, nil
 | 
						return r.Data, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetProvinceByCondition ...
 | 
				
			||||||
 | 
					func (l Location) GetProvinceByCondition(p model.RequestCondition) (*model.LocationProvinceDetailResponse, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetProvinceByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  *model.LocationProvinceDetailResponse `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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetProvincesByCondition ...
 | 
				
			||||||
 | 
					func (l Location) GetProvincesByCondition(p model.RequestCondition) ([]*model.LocationProvinceDetailResponse, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetProvincesByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  []*model.LocationProvinceDetailResponse `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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetDistrictByCondition ...
 | 
				
			||||||
 | 
					func (l Location) GetDistrictByCondition(p model.RequestCondition) (*model.LocationDistrictDetailResponse, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetDistrictByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  *model.LocationDistrictDetailResponse `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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetDistrictsByCondition ...
 | 
				
			||||||
 | 
					func (l Location) GetDistrictsByCondition(p model.RequestCondition) ([]*model.LocationDistrictDetailResponse, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetDistrictsByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  []*model.LocationDistrictDetailResponse `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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetWardByCondition ...
 | 
				
			||||||
 | 
					func (l Location) GetWardByCondition(p model.RequestCondition) (*model.LocationWardDetailResponse, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetWardByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  *model.LocationWardDetailResponse `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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetWardsByCondition ...
 | 
				
			||||||
 | 
					func (l Location) GetWardsByCondition(p model.RequestCondition) ([]*model.LocationWardDetailResponse, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.GetWardsByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  []*model.LocationWardDetailResponse `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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CountProvinceByCondition ...
 | 
				
			||||||
 | 
					func (l Location) CountProvinceByCondition(p model.RequestCondition) (int64, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.CountProvinceByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  int64  `json:"data"`
 | 
				
			||||||
 | 
							Error string `json:"error"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if r.Error != "" {
 | 
				
			||||||
 | 
							return 0, errors.New(r.Error)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return r.Data, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CountDistrictByCondition ...
 | 
				
			||||||
 | 
					func (l Location) CountDistrictByCondition(p model.RequestCondition) (int64, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.CountDistrictByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  int64  `json:"data"`
 | 
				
			||||||
 | 
							Error string `json:"error"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if r.Error != "" {
 | 
				
			||||||
 | 
							return 0, errors.New(r.Error)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return r.Data, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// CountWardByCondition ...
 | 
				
			||||||
 | 
					func (l Location) CountWardByCondition(p model.RequestCondition) (int64, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.CountWardByCondition, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  int64  `json:"data"`
 | 
				
			||||||
 | 
							Error string `json:"error"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
 | 
							return 0, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if r.Error != "" {
 | 
				
			||||||
 | 
							return 0, errors.New(r.Error)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return r.Data, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// DistinctWithField ...
 | 
				
			||||||
 | 
					func (l Location) DistinctWithField(p model.ProvinceDistinctWithField) ([]interface{}, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Location.ProvinceDistinctWithField, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Data  []interface{} `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,26 @@ type ActionBy struct {
 | 
				
			||||||
	ID   string `json:"id"`
 | 
						ID   string `json:"id"`
 | 
				
			||||||
	Name string `json:"name"`
 | 
						Name string `json:"name"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// RequestCondition ...
 | 
				
			||||||
 | 
					type RequestCondition struct {
 | 
				
			||||||
 | 
						Code         int   `json:"code"`
 | 
				
			||||||
 | 
						Codes        []int `json:"codes"`
 | 
				
			||||||
 | 
						DistrictCode int   `json:"districtCode"`
 | 
				
			||||||
 | 
						ProvinceCode int   `json:"provinceCode"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Slug    string `json:"slug"`
 | 
				
			||||||
 | 
						OldSlug string `json:"oldSlug"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Slugs    []string `json:"slugs"`
 | 
				
			||||||
 | 
						OldSlugs []string `json:"oldSlugs"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						DistrictSlug string `json:"districtSlug"`
 | 
				
			||||||
 | 
						ProvinceSlug string `json:"provinceSlug"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Keyword string `json:"keyword"`
 | 
				
			||||||
 | 
						Region  string `json:"region"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Page  int64 `json:"page"`
 | 
				
			||||||
 | 
						Limit int64 `json:"limit"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,23 +1,66 @@
 | 
				
			||||||
package model
 | 
					package model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationRequestPayload ...
 | 
					// LocationRequestPayload ...
 | 
				
			||||||
type LocationRequestPayload struct {
 | 
					type (
 | 
				
			||||||
	Province int `json:"province"`
 | 
						// LocationRequestPayload ...
 | 
				
			||||||
	District int `json:"district"`
 | 
						LocationRequestPayload struct {
 | 
				
			||||||
	Ward     int `json:"ward"`
 | 
							Province int `json:"province"`
 | 
				
			||||||
}
 | 
							District int `json:"district"`
 | 
				
			||||||
 | 
							Ward     int `json:"ward"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ProvinceRequestPayload ...
 | 
						// ProvinceRequestPayload ...
 | 
				
			||||||
type ProvinceRequestPayload struct {
 | 
						ProvinceRequestPayload struct {
 | 
				
			||||||
	Codes []int `json:"codes"`
 | 
							Codes []int `json:"codes"`
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DistrictRequestPayload ...
 | 
						// ProvinceRequestCondition ...
 | 
				
			||||||
type DistrictRequestPayload struct {
 | 
						ProvinceRequestCondition struct {
 | 
				
			||||||
	Codes []int `json:"codes"`
 | 
							Code    int      `json:"code"`
 | 
				
			||||||
}
 | 
							Codes   []int    `json:"codes"`
 | 
				
			||||||
 | 
							Slug    string   `json:"slug"`
 | 
				
			||||||
 | 
							Slugs   []string `json:"slugs"`
 | 
				
			||||||
 | 
							Keyword string   `json:"keyword"`
 | 
				
			||||||
 | 
							Region  string   `json:"region"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// WardRequestPayload ...
 | 
						// DistrictRequestPayload ...
 | 
				
			||||||
type WardRequestPayload struct {
 | 
						DistrictRequestPayload struct {
 | 
				
			||||||
	Codes []int `json:"codes"`
 | 
							Codes []int `json:"codes"`
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// DistrictRequestCondition ...
 | 
				
			||||||
 | 
						DistrictRequestCondition struct {
 | 
				
			||||||
 | 
							Code         int    `json:"code"`
 | 
				
			||||||
 | 
							Codes        []int  `json:"codes"`
 | 
				
			||||||
 | 
							ProvinceCode int    `json:"provinceCode"`
 | 
				
			||||||
 | 
							Slug         string `json:"slug"`
 | 
				
			||||||
 | 
							ProvinceSlug string `json:"provinceSlug"`
 | 
				
			||||||
 | 
							Keyword      string `json:"keyword"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// WardRequestPayload ...
 | 
				
			||||||
 | 
						WardRequestPayload struct {
 | 
				
			||||||
 | 
							Codes []int `json:"codes"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// WardRequestCondition ...
 | 
				
			||||||
 | 
						WardRequestCondition struct {
 | 
				
			||||||
 | 
							Code         int    `json:"code"`
 | 
				
			||||||
 | 
							Codes        []int  `json:"codes"`
 | 
				
			||||||
 | 
							DistrictCode int    `json:"districtCode"`
 | 
				
			||||||
 | 
							ProvinceCode int    `json:"provinceCode"`
 | 
				
			||||||
 | 
							Slug         string `json:"slug"`
 | 
				
			||||||
 | 
							DistrictSlug string `json:"districtSlug"`
 | 
				
			||||||
 | 
							ProvinceSlug string `json:"provinceSlug"`
 | 
				
			||||||
 | 
							Keyword      string `json:"keyword"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// ProvinceDistinctWithField ...
 | 
				
			||||||
 | 
						ProvinceDistinctWithField struct {
 | 
				
			||||||
 | 
							Conditions struct {
 | 
				
			||||||
 | 
								Region string `json:"region"`
 | 
				
			||||||
 | 
							} `json:"conditions"`
 | 
				
			||||||
 | 
							Field string `json:"filed"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,43 +1,87 @@
 | 
				
			||||||
package model
 | 
					package model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ResponseLocationAddress struct {
 | 
					type (
 | 
				
			||||||
	Province LocationProvince `json:"province"`
 | 
						// ResponseLocationAddress ...
 | 
				
			||||||
	District LocationDistrict `json:"district"`
 | 
						ResponseLocationAddress struct {
 | 
				
			||||||
	Ward     LocationWard     `json:"ward"`
 | 
							Province LocationProvince `json:"province"`
 | 
				
			||||||
}
 | 
							District LocationDistrict `json:"district"`
 | 
				
			||||||
 | 
							Ward     LocationWard     `json:"ward"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationProvince ...
 | 
						// LocationProvince ...
 | 
				
			||||||
type LocationProvince struct {
 | 
						LocationProvince struct {
 | 
				
			||||||
	ID   string `json:"id"`
 | 
							ID             string `json:"id"`
 | 
				
			||||||
	Name string `json:"name"`
 | 
							Name           string `json:"name"`
 | 
				
			||||||
	Code int    `json:"code"`
 | 
							Code           int    `json:"code"`
 | 
				
			||||||
}
 | 
							Slug           string `json:"slug"`
 | 
				
			||||||
 | 
							RegionCode     string `json:"regionCode"`
 | 
				
			||||||
 | 
							MainRegionCode string `json:"mainRegionCode"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationDistrict ...
 | 
						// LocationDistrict ...
 | 
				
			||||||
type LocationDistrict struct {
 | 
						LocationDistrict struct {
 | 
				
			||||||
	ID   string `json:"id"`
 | 
							ID   string `json:"id"`
 | 
				
			||||||
	Name string `json:"name"`
 | 
							Name string `json:"name"`
 | 
				
			||||||
	Code int    `json:"code"`
 | 
							Code int    `json:"code"`
 | 
				
			||||||
}
 | 
							Slug string `json:"slug"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationWard ...
 | 
						// LocationWard ...
 | 
				
			||||||
type LocationWard struct {
 | 
						LocationWard struct {
 | 
				
			||||||
	ID   string `json:"id"`
 | 
							ID   string `json:"id"`
 | 
				
			||||||
	Name string `json:"name"`
 | 
							Name string `json:"name"`
 | 
				
			||||||
	Code int    `json:"code"`
 | 
							Code int    `json:"code"`
 | 
				
			||||||
}
 | 
							Slug string `json:"slug"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationProvinceResponse ...
 | 
						// LocationProvinceResponse ...
 | 
				
			||||||
type LocationProvinceResponse struct {
 | 
						LocationProvinceResponse struct {
 | 
				
			||||||
	Provinces []LocationProvince `json:"provinces"`
 | 
							Provinces []LocationProvince `json:"provinces"`
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationDistrictResponse ...
 | 
						// LocationDistrictResponse ...
 | 
				
			||||||
type LocationDistrictResponse struct {
 | 
						LocationDistrictResponse struct {
 | 
				
			||||||
	Districts []LocationDistrict `json:"districts"`
 | 
							Districts []LocationDistrict `json:"districts"`
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LocationWardResponse ...
 | 
						// LocationWardResponse ...
 | 
				
			||||||
type LocationWardResponse struct {
 | 
						LocationWardResponse struct {
 | 
				
			||||||
	Wards []LocationWard `json:"wards"`
 | 
							Wards []LocationWard `json:"wards"`
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// LocationProvinceDetailResponse ...
 | 
				
			||||||
 | 
						LocationProvinceDetailResponse struct {
 | 
				
			||||||
 | 
							ID             string `json:"_id"`
 | 
				
			||||||
 | 
							Name           string `json:"name"`
 | 
				
			||||||
 | 
							Slug           string `json:"slug"`
 | 
				
			||||||
 | 
							Code           int    `json:"code"`
 | 
				
			||||||
 | 
							CountryCode    string `json:"countryCode"`
 | 
				
			||||||
 | 
							RegionCode     string `json:"regionCode"`
 | 
				
			||||||
 | 
							MainRegionCode string `json:"mainRegionCode"`
 | 
				
			||||||
 | 
							TotalDistricts int    `json:"totalDistricts"`
 | 
				
			||||||
 | 
							TotalWards     int    `json:"totalWards"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// LocationDistrictDetailResponse ...
 | 
				
			||||||
 | 
						LocationDistrictDetailResponse struct {
 | 
				
			||||||
 | 
							ID           string   `json:"_id"`
 | 
				
			||||||
 | 
							Name         string   `json:"name"`
 | 
				
			||||||
 | 
							OldSlugs     []string `json:"oldSlugs"`
 | 
				
			||||||
 | 
							Slug         string   `json:"slug"`
 | 
				
			||||||
 | 
							Code         int      `json:"code"`
 | 
				
			||||||
 | 
							ProvinceCode int      `json:"provinceCode"`
 | 
				
			||||||
 | 
							Area         int      `json:"area"`
 | 
				
			||||||
 | 
							TotalWards   int      `json:"totalWards"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// LocationWardDetailResponse ...
 | 
				
			||||||
 | 
						LocationWardDetailResponse struct {
 | 
				
			||||||
 | 
							ID           string   `json:"_id"`
 | 
				
			||||||
 | 
							Name         string   `json:"name"`
 | 
				
			||||||
 | 
							OldSlugs     []string `json:"oldSlugs"`
 | 
				
			||||||
 | 
							Slug         string   `json:"slug"`
 | 
				
			||||||
 | 
							Code         int      `json:"code"`
 | 
				
			||||||
 | 
							DistrictCode int      `json:"districtCode"`
 | 
				
			||||||
 | 
							ProvinceCode int      `json:"provinceCode"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,13 +7,41 @@ func getLocationValue(val string) string {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var Location = struct {
 | 
					var Location = struct {
 | 
				
			||||||
	GetLocationByCode   string
 | 
						GetLocationByCode                      string
 | 
				
			||||||
	GetProvincesByCodes string
 | 
						GetLocationByCodeFromLocationService   string
 | 
				
			||||||
	GetDistrictsByCodes string
 | 
						GetProvincesByCodes                    string
 | 
				
			||||||
	GetWardsByCodes     string
 | 
						GetProvincesByCodesFromLocationService string
 | 
				
			||||||
 | 
						GetDistrictsByCodes                    string
 | 
				
			||||||
 | 
						GetDistrictsByCodesFromLocationService string
 | 
				
			||||||
 | 
						GetWardsByCodes                        string
 | 
				
			||||||
 | 
						GetWardsByCodesFromLocationService     string
 | 
				
			||||||
 | 
						GetProvinceByCondition                 string
 | 
				
			||||||
 | 
						GetProvincesByCondition                string
 | 
				
			||||||
 | 
						GetDistrictByCondition                 string
 | 
				
			||||||
 | 
						GetDistrictsByCondition                string
 | 
				
			||||||
 | 
						GetWardByCondition                     string
 | 
				
			||||||
 | 
						GetWardsByCondition                    string
 | 
				
			||||||
 | 
						CountProvinceByCondition               string
 | 
				
			||||||
 | 
						CountDistrictByCondition               string
 | 
				
			||||||
 | 
						CountWardByCondition                   string
 | 
				
			||||||
 | 
						ProvinceDistinctWithField              string
 | 
				
			||||||
}{
 | 
					}{
 | 
				
			||||||
	GetLocationByCode:   getLocationValue("get_location_warehouse"),
 | 
						GetLocationByCode:                      getLocationValue("get_location_warehouse"),
 | 
				
			||||||
	GetProvincesByCodes: getLocationValue("get_provinces_by_codes"),
 | 
						GetLocationByCodeFromLocationService:   getLocationValue("get_location_warehouse_from_location_service"),
 | 
				
			||||||
	GetDistrictsByCodes: getLocationValue("get_districts_by_codes"),
 | 
						GetProvincesByCodes:                    getLocationValue("get_provinces_by_codes"),
 | 
				
			||||||
	GetWardsByCodes:     getLocationValue("get_wards_by_codes"),
 | 
						GetProvincesByCodesFromLocationService: getLocationValue("get_provinces_by_codes_from_location_service"),
 | 
				
			||||||
 | 
						GetDistrictsByCodes:                    getLocationValue("get_districts_by_codes"),
 | 
				
			||||||
 | 
						GetDistrictsByCodesFromLocationService: getLocationValue("get_districts_by_codes_from_location_service"),
 | 
				
			||||||
 | 
						GetWardsByCodes:                        getLocationValue("get_wards_by_codes"),
 | 
				
			||||||
 | 
						GetWardsByCodesFromLocationService:     getLocationValue("get_wards_by_codes_from_location_service"),
 | 
				
			||||||
 | 
						GetProvinceByCondition:                 getLocationValue("get_province_by_condition"),
 | 
				
			||||||
 | 
						GetProvincesByCondition:                getLocationValue("get_provinces_by_condition"),
 | 
				
			||||||
 | 
						GetDistrictByCondition:                 getLocationValue("get_district_by_condition"),
 | 
				
			||||||
 | 
						GetDistrictsByCondition:                getLocationValue("get_districts_byCondition"),
 | 
				
			||||||
 | 
						GetWardByCondition:                     getLocationValue("get_ward_by_condition"),
 | 
				
			||||||
 | 
						GetWardsByCondition:                    getLocationValue("get_wards_by_condition"),
 | 
				
			||||||
 | 
						CountProvinceByCondition:               getLocationValue("count_province_by_condition"),
 | 
				
			||||||
 | 
						CountDistrictByCondition:               getLocationValue("count_district_by_condition"),
 | 
				
			||||||
 | 
						CountWardByCondition:                   getLocationValue("count_ward_by_condition"),
 | 
				
			||||||
 | 
						ProvinceDistinctWithField:              getLocationValue("province_distinct_with_field"),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue