Added route for saving device info
This commit is contained in:
@@ -7,6 +7,7 @@ type Device struct {
|
||||
DeviceName string
|
||||
DeviceConfiguration string `gorm:"type:json"`
|
||||
CompanyID uint
|
||||
DeviceInfos []DeviceInfo
|
||||
}
|
||||
|
||||
func (Device)Update() (bool, error) {
|
||||
|
||||
39
models/device_info.go
Normal file
39
models/device_info.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
|
||||
// Location holds latitude and longitude.
|
||||
type Location struct {
|
||||
Lat float64 `json:"lat"`
|
||||
Lon float64 `json:"lon"`
|
||||
}
|
||||
|
||||
// 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:"wifi_location"`
|
||||
CellLoc Location `json:"cell_location"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
}
|
||||
|
||||
|
||||
type DeviceInfo struct {
|
||||
gorm.Model
|
||||
RawJSON string `json:"raw_json" gorm:"type:json"`
|
||||
SensorData
|
||||
DeviceID uint
|
||||
}
|
||||
|
||||
func (DeviceInfo)Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (DeviceInfo)Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (DeviceInfo)Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
Reference in New Issue
Block a user