2023-09-06 11:58:33 +02:00
|
|
|
package models
|
|
|
|
|
|
2023-09-19 05:09:33 +02:00
|
|
|
import (
|
|
|
|
|
"github.com/jinzhu/gorm"
|
|
|
|
|
)
|
2023-09-06 11:58:33 +02:00
|
|
|
|
|
|
|
|
type Device struct {
|
|
|
|
|
gorm.Model
|
2023-09-19 08:15:42 +02:00
|
|
|
DeviceID string `json:"deviceId"`
|
2023-09-18 12:27:40 +02:00
|
|
|
DeviceName string
|
|
|
|
|
IMEI string `json:"imei"`
|
|
|
|
|
IMSI string `json:"imsi"`
|
|
|
|
|
DeviceConfiguration string `gorm:"type:json"`
|
|
|
|
|
CompanyID uint
|
|
|
|
|
DeviceInfos []DeviceInfo
|
2023-09-06 11:58:33 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-18 12:27:40 +02:00
|
|
|
func (Device) Update() (bool, error) {
|
2023-09-06 11:58:33 +02:00
|
|
|
return false, nil
|
|
|
|
|
}
|
2023-09-18 12:27:40 +02:00
|
|
|
func (Device) Create() (bool, error) {
|
2023-09-06 11:58:33 +02:00
|
|
|
return false, nil
|
|
|
|
|
}
|
2023-09-19 05:09:33 +02:00
|
|
|
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
|
2023-09-06 11:58:33 +02:00
|
|
|
}
|