add image_urls to nearest device
This commit is contained in:
parent
8edbdfaa56
commit
433512e3da
|
|
@ -20,6 +20,7 @@ type NearestDeviceResponse struct {
|
||||||
Province *string `json:"province,omitempty"`
|
Province *string `json:"province,omitempty"`
|
||||||
City *string `json:"city,omitempty"`
|
City *string `json:"city,omitempty"`
|
||||||
District *string `json:"district,omitempty"`
|
District *string `json:"district,omitempty"`
|
||||||
|
ImageURL *string `json:"image_url"`
|
||||||
|
|
||||||
// Connection counts
|
// Connection counts
|
||||||
BackboneCount int `json:"backbone_count"`
|
BackboneCount int `json:"backbone_count"`
|
||||||
|
|
@ -44,7 +45,8 @@ type NearestDeviceDetailResponse struct {
|
||||||
Province *string `json:"province,omitempty"`
|
Province *string `json:"province,omitempty"`
|
||||||
City *string `json:"city,omitempty"`
|
City *string `json:"city,omitempty"`
|
||||||
District *string `json:"district,omitempty"`
|
District *string `json:"district,omitempty"`
|
||||||
ImageURL *string `json:"image_url,omitempty"`
|
ImageURL *string `json:"image_url"`
|
||||||
|
ImageURLs []string `json:"image_urls"`
|
||||||
|
|
||||||
// Detailed connection information
|
// Detailed connection information
|
||||||
Backbones []BackboneConnectionInfo `json:"backbones"`
|
Backbones []BackboneConnectionInfo `json:"backbones"`
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ func ConvertToNearestDeviceResponses(devices []entity.DeviceWithDistance, repo r
|
||||||
Province: device.Province,
|
Province: device.Province,
|
||||||
City: device.City,
|
City: device.City,
|
||||||
District: device.District,
|
District: device.District,
|
||||||
|
ImageURL: device.ImageURL,
|
||||||
BackboneCount: backboneCount,
|
BackboneCount: backboneCount,
|
||||||
FishboneCount: fishboneCount,
|
FishboneCount: fishboneCount,
|
||||||
TowerCount: towerCount,
|
TowerCount: towerCount,
|
||||||
|
|
@ -95,6 +96,13 @@ func ConvertToNearestDeviceDetailResponse(device entity.Device, distance float64
|
||||||
fishboneInfos := convertToFishboneConnectionInfos(fishbones, device.ID)
|
fishboneInfos := convertToFishboneConnectionInfos(fishbones, device.ID)
|
||||||
towerInfos := convertToTowerConnectionInfos(towers, device.Latitude, device.Longitude)
|
towerInfos := convertToTowerConnectionInfos(towers, device.Latitude, device.Longitude)
|
||||||
|
|
||||||
|
allImageURLs := device.GetAllImageURLs()
|
||||||
|
if len(allImageURLs) == 0 {
|
||||||
|
allImageURLs = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Device %s has %d images", device.DeviceCode, len(allImageURLs))
|
||||||
|
|
||||||
response := res.NearestDeviceDetailResponse{
|
response := res.NearestDeviceDetailResponse{
|
||||||
ID: device.ID,
|
ID: device.ID,
|
||||||
DeviceCode: device.DeviceCode,
|
DeviceCode: device.DeviceCode,
|
||||||
|
|
@ -108,7 +116,7 @@ func ConvertToNearestDeviceDetailResponse(device entity.Device, distance float64
|
||||||
Province: device.Province,
|
Province: device.Province,
|
||||||
City: device.City,
|
City: device.City,
|
||||||
District: device.District,
|
District: device.District,
|
||||||
ImageURL: device.ImageURL,
|
ImageURLs: device.GetAllImageURLs(),
|
||||||
Backbones: backboneInfos,
|
Backbones: backboneInfos,
|
||||||
Fishbones: fishboneInfos,
|
Fishbones: fishboneInfos,
|
||||||
Towers: towerInfos,
|
Towers: towerInfos,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue