24 lines
868 B
Go
24 lines
868 B
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Tower struct {
|
|
ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey"`
|
|
DeviceID *uuid.UUID `json:"dev_id,omitempty" gorm:"type:uuid;column:dev_id;null"` // Make nullable
|
|
TowerCode string `json:"tower_code" gorm:"unique"`
|
|
Longitude float64 `json:"longitude"`
|
|
Latitude float64 `json:"latitude"`
|
|
ImageURL string `json:"image_url" gorm:"column:image_url"`
|
|
ExternalTower *bool `json:"external_tower,omitempty" gorm:"column:external_tower;null"` // Make nullable and fix typo
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
Device *Device `json:"device,omitempty" gorm:"foreignKey:DeviceID"` // Make nullable
|
|
}
|
|
|
|
func (Tower) TableName() string {
|
|
return "towers"
|
|
} |