24 lines
762 B
Go
24 lines
762 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;not null"`
|
|
PortUsed int `json:"port_used"`
|
|
PortAvailable int `json:"port_available"`
|
|
CustomerCount int `json:"customer_count"` // Add this field
|
|
CustomerNames []string `json:"customer_names" gorm:"type:json"` // Store customer names as JSON array
|
|
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"
|
|
} |