Upstream sync
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
// Location holds latitude and longitude.
|
||||
type Location struct {
|
||||
Lat float64 `json:"lat"`
|
||||
@@ -12,32 +8,31 @@ type Location struct {
|
||||
|
||||
// ImportantInfo holds fields that are important for quick access.
|
||||
type SensorData struct {
|
||||
IMEI string `json:"imei"`
|
||||
IMSI string `json:"imsi"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Lat float64 `json:"lat"`
|
||||
Lon float64 `json:"lon"`
|
||||
WifiLoc Location `json:"wifiLocation"`
|
||||
CellLoc Location `json:"cellLocation"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
AccInfo AccelerometerInfo `json:"accelerometerInfo"`
|
||||
IMEI string `json:"imei"`
|
||||
IMSI string `json:"imsi"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Lat float64 `json:"lat"`
|
||||
Lon float64 `json:"lon"`
|
||||
WifiLoc Location `json:"wifiLocation"`
|
||||
CellLoc Location `json:"cellLocation"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
AccInfo AccelerometerInfo `json:"accelerometerInfo"`
|
||||
AccelerometerInfo
|
||||
}
|
||||
|
||||
type DeviceInfo struct {
|
||||
gorm.Model
|
||||
BaseModel
|
||||
RawJSON string `json:"raw_json" gorm:"type:json"`
|
||||
SensorData
|
||||
DeviceID uint
|
||||
DeviceID uint
|
||||
ExternalDeviceID string `json:"deviceId"`
|
||||
}
|
||||
|
||||
|
||||
type DeviceInfoResponse struct {
|
||||
BaseModel
|
||||
RawJSON string `json:"rawJson" gorm:"type:json"`
|
||||
SensorData
|
||||
DeviceID uint `json:"deviceId"`
|
||||
DeviceID uint `json:"deviceId"`
|
||||
ExternalDeviceID string `json:"externalDeviceId"`
|
||||
}
|
||||
|
||||
@@ -51,7 +46,7 @@ func ConvertDeviceInfoToResponse(deviceInfos []DeviceInfo) []DeviceInfoResponse
|
||||
UpdatedAt: deviceInfo.UpdatedAt,
|
||||
},
|
||||
RawJSON: deviceInfo.RawJSON,
|
||||
SensorData: deviceInfo.SensorData,
|
||||
SensorData: deviceInfo.SensorData,
|
||||
DeviceID: deviceInfo.DeviceID,
|
||||
ExternalDeviceID: deviceInfo.ExternalDeviceID,
|
||||
}
|
||||
@@ -71,10 +66,10 @@ type GeoJSONFeatureCollection struct {
|
||||
}
|
||||
|
||||
type GeoJSONFeature struct {
|
||||
Type string `json:"type"`
|
||||
Geometry GeoJSONGeometry `json:"geometry"`
|
||||
DeviceInfoResponse *DeviceInfoResponse `json:"deviceInfo,omitempty"`
|
||||
Properties map[string]interface{} `json:"properties"`
|
||||
Type string `json:"type"`
|
||||
Geometry GeoJSONGeometry `json:"geometry"`
|
||||
DeviceInfoResponse *DeviceInfoResponse `json:"deviceInfo,omitempty"`
|
||||
Properties map[string]interface{} `json:"properties"`
|
||||
}
|
||||
|
||||
type GeoJSONGeometry struct {
|
||||
@@ -91,6 +86,3 @@ func (DeviceInfo) Create() (bool, error) {
|
||||
func (DeviceInfo) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user