Upstream sync
This commit is contained in:
@@ -4,7 +4,7 @@ import "github.com/jinzhu/gorm"
|
||||
|
||||
type Company struct {
|
||||
gorm.Model
|
||||
Name string
|
||||
Name string
|
||||
Password string
|
||||
Email string
|
||||
Avatar string
|
||||
@@ -12,7 +12,6 @@ type Company struct {
|
||||
Devices []Device
|
||||
}
|
||||
|
||||
|
||||
// func FetchCompanies(companies *[]Company) (err error) {
|
||||
// db := gorm.GetDb()
|
||||
|
||||
@@ -22,12 +21,12 @@ type Company struct {
|
||||
// return nil
|
||||
// }
|
||||
|
||||
func (Company)Update() (bool, error) {
|
||||
func (Company) Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Company)Create() (bool, error) {
|
||||
func (Company) Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Company)Delete() (bool, error) {
|
||||
func (Company) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
23
models/contract.go
Normal file
23
models/contract.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
|
||||
type Contract struct {
|
||||
gorm.Model
|
||||
Name string
|
||||
DeviceID []uint
|
||||
BuyerID uint
|
||||
Status string
|
||||
BlockchainID string
|
||||
ContractInfos []ContractInfo
|
||||
}
|
||||
|
||||
func (Contract) Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Contract) Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Contract) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
18
models/contract_info.go
Normal file
18
models/contract_info.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
|
||||
type ContractInfo struct {
|
||||
gorm.Model
|
||||
RawJSON string `json:"raw_json" gorm:"type:json"`
|
||||
}
|
||||
|
||||
func (ContractInfo) Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (ContractInfo) Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (ContractInfo) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package models
|
||||
|
||||
type SimpleCRUD interface {
|
||||
Create() (bool,error)
|
||||
Update()( bool,error)
|
||||
Delete() (bool,error)
|
||||
|
||||
Create() (bool, error)
|
||||
Update() (bool, error)
|
||||
Delete() (bool, error)
|
||||
}
|
||||
|
||||
@@ -4,20 +4,20 @@ import "github.com/jinzhu/gorm"
|
||||
|
||||
type Device struct {
|
||||
gorm.Model
|
||||
DeviceName string
|
||||
IMEI string `json:"imei"`
|
||||
IMSI string `json:"imsi"`
|
||||
DeviceConfiguration string `gorm:"type:json"`
|
||||
CompanyID uint
|
||||
DeviceInfos []DeviceInfo
|
||||
DeviceName string
|
||||
IMEI string `json:"imei"`
|
||||
IMSI string `json:"imsi"`
|
||||
DeviceConfiguration string `gorm:"type:json"`
|
||||
CompanyID uint
|
||||
DeviceInfos []DeviceInfo
|
||||
}
|
||||
|
||||
func (Device)Update() (bool, error) {
|
||||
func (Device) Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Device)Create() (bool, error) {
|
||||
func (Device) Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Device)Delete() (bool, error) {
|
||||
func (Device) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -10,30 +10,29 @@ 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:"wifi_location"`
|
||||
CellLoc Location `json:"cell_location"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
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
|
||||
SensorData
|
||||
DeviceID uint
|
||||
}
|
||||
|
||||
func (DeviceInfo)Update() (bool, error) {
|
||||
func (DeviceInfo) Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (DeviceInfo)Create() (bool, error) {
|
||||
func (DeviceInfo) Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (DeviceInfo)Delete() (bool, error) {
|
||||
func (DeviceInfo) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ import "github.com/jinzhu/gorm"
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
Username string
|
||||
Password string
|
||||
Email string
|
||||
Avatar string
|
||||
CompanyID uint
|
||||
Username string
|
||||
Password string
|
||||
Email string
|
||||
Avatar string
|
||||
CompanyID uint
|
||||
}
|
||||
|
||||
func (User)Update() (bool, error) {
|
||||
func (User) Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (User)Create() (bool, error) {
|
||||
func (User) Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (User)Delete() (bool, error) {
|
||||
func (User) Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user