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

28 lines
1.1 KiB
Go

package entity
import (
"time"
"github.com/google/uuid"
)
type CableConnection struct {
ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey"`
FromDeviceID uuid.UUID `json:"from_device_id" gorm:"type:uuid;not null"`
ToDeviceID uuid.UUID `json:"to_device_id" gorm:"type:uuid;not null"`
CableLength float64 `json:"cable_length" gorm:"type:decimal(10,3);not null"`
CableType *string `json:"cable_type" gorm:"type:varchar(100);not null"`
BranchingType *string `json:"branching_type,omitempty" gorm:"type:varchar(50)"`
InstallationDate *time.Time `json:"installation_date,omitempty"`
Status DeviceStatus `json:"status" gorm:"default:'active'"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FromDevice *Device `json:"from_device,omitempty" gorm:"foreignKey:FromDeviceID;references:ID"`
ToDevice *Device `json:"to_device,omitempty" gorm:"foreignKey:ToDeviceID;references:ID"`
}
func (CableConnection) TableName() string {
return "cable_connections"
}