36 lines
993 B
Go
36 lines
993 B
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type DeviceType string
|
|
type DeviceStatus string
|
|
|
|
const (
|
|
Odp DeviceType = "ODP"
|
|
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"`
|
|
Region string `json:"region"`
|
|
Province string `json:"province"`
|
|
City string `json:"city"`
|
|
District string `json:"district"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func (Device) TableName() string {
|
|
return "devices"
|
|
} |