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"`
|
||||
City *string `json:"city,omitempty"`
|
||||
District *string `json:"district,omitempty"`
|
||||
ImageURL *string `json:"image_url"`
|
||||
|
||||
// Connection counts
|
||||
BackboneCount int `json:"backbone_count"`
|
||||
|
|
@ -44,7 +45,8 @@ type NearestDeviceDetailResponse struct {
|
|||
Province *string `json:"province,omitempty"`
|
||||
City *string `json:"city,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
|
||||
Backbones []BackboneConnectionInfo `json:"backbones"`
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ func ConvertToNearestDeviceResponses(devices []entity.DeviceWithDistance, repo r
|
|||
Province: device.Province,
|
||||
City: device.City,
|
||||
District: device.District,
|
||||
ImageURL: device.ImageURL,
|
||||
BackboneCount: backboneCount,
|
||||
FishboneCount: fishboneCount,
|
||||
TowerCount: towerCount,
|
||||
|
|
@ -95,6 +96,13 @@ func ConvertToNearestDeviceDetailResponse(device entity.Device, distance float64
|
|||
fishboneInfos := convertToFishboneConnectionInfos(fishbones, device.ID)
|
||||
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{
|
||||
ID: device.ID,
|
||||
DeviceCode: device.DeviceCode,
|
||||
|
|
@ -108,7 +116,7 @@ func ConvertToNearestDeviceDetailResponse(device entity.Device, distance float64
|
|||
Province: device.Province,
|
||||
City: device.City,
|
||||
District: device.District,
|
||||
ImageURL: device.ImageURL,
|
||||
ImageURLs: device.GetAllImageURLs(),
|
||||
Backbones: backboneInfos,
|
||||
Fishbones: fishboneInfos,
|
||||
Towers: towerInfos,
|
||||
|
|
|
|||
Loading…
Reference in New Issue