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

26 lines
959 B
Go

package entity
import (
"time"
"github.com/google/uuid"
)
type Fishbone struct {
ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey"`
FishboneCode string `json:"fishbone_code" gorm:"unique"`
BackboneID uuid.UUID `json:"bb_id" gorm:"type:uuid;column:bb_id"`
DeviceStartID uuid.UUID `json:"dev_start_id" gorm:"type:uuid;column:dev_start_id"`
DeviceEndID *uuid.UUID `json:"dev_end_id" gorm:"type:uuid;column:dev_end_id"`
CoreAmount int `json:"core_amount" gorm:"column:core_amount"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Relationships
Backbone Backbone `json:"backbone" gorm:"foreignKey:BackboneID"`
DeviceStart Device `json:"device_start" gorm:"foreignKey:DeviceStartID"`
DeviceEnd Device `json:"device_end" gorm:"foreignKey:DeviceEndID"`
}
func (Fishbone) TableName() string {
return "fishbone"
}