NAM-APJATEL-BACKEND/model/entity/devices.go

40 lines
1.2 KiB
Go

package entity
import (
"time"
"github.com/google/uuid"
)
type DeviceType string
type DeviceStatus string
const (
ODP DeviceType = "ODP"
OTB DeviceType = "OTB"
Closure DeviceType = "closure"
ActiveDev DeviceStatus = "active"
InactiveDev DeviceStatus = "inactive"
MaintenanceDev DeviceStatus = "maintenance"
)
type Device struct {
ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey"`
DeviceCode string `json:"device_code" gorm:"unique"`
DeviceType DeviceType `json:"device_type"`
Longitude float64 `json:"longitude"`
Latitude float64 `json:"latitude"`
PortAmount int `json:"port_amount"`
Status DeviceStatus `json:"status"`
Province *string `json:"province,omitempty" gorm:"type:varchar(255)"`
City *string `json:"city,omitempty" gorm:"type:varchar(255)"`
District *string `json:"district,omitempty" gorm:"type:varchar(255)"`
ImageURL *string `json:"image_url,omitempty" gorm:"type:text"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Device) TableName() string {
return "devices"
}