33 lines
643 B
Go
33 lines
643 B
Go
package models
|
|
|
|
import (
|
|
"github.com/jinzhu/gorm"
|
|
)
|
|
|
|
type Device struct {
|
|
gorm.Model
|
|
DeviceID string `json:"deviceId"`
|
|
DeviceName string
|
|
IMEI string `json:"imei"`
|
|
IMSI string `json:"imsi"`
|
|
DeviceConfiguration string `gorm:"type:json"`
|
|
CompanyID uint
|
|
DeviceInfos []DeviceInfo
|
|
}
|
|
|
|
func (Device) Update() (bool, error) {
|
|
return false, nil
|
|
}
|
|
func (Device) Create() (bool, error) {
|
|
return false, nil
|
|
}
|
|
func (d *Device) Delete(db *gorm.DB) (bool, error) {
|
|
|
|
// Soft delete the device record.
|
|
if err := db.Delete(d).Error; err != nil {
|
|
return false, err
|
|
}
|
|
|
|
return true, nil
|
|
}
|