22 lines
685 B
Go
22 lines
685 B
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type DevicePort struct {
|
|
ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey"`
|
|
DeviceID uuid.UUID `json:"device_id" gorm:"type:uuid;column:device_id;unique"`
|
|
PortUsed int `json:"port_used" gorm:"default:0"` // Auto-calculated
|
|
PortAvailable int `json:"port_available" gorm:"default:0"` // Auto-calculated
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
// Relationships
|
|
Device Device `json:"device" gorm:"foreignKey:DeviceID"`
|
|
}
|
|
|
|
func (DevicePort) TableName() string {
|
|
return "device_ports"
|
|
} |