26 lines
757 B
Go
26 lines
757 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Endpoint struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
|
|
Path string `gorm:"not null;default:/" json:"path"`
|
|
RecordID uuid.UUID `gorm:"not null;uniqueIndex:idx_endpoint_record_id" json:"record_id"`
|
|
CreatedAt time.Time `gorm:"not null;default:now()" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"not null;default:now()" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
|
|
|
|
Record Record `gorm:"foreignKey:RecordID" json:"-"`
|
|
|
|
EndpointGroups []EndpointGroup `gorm:"foreignKey:EndpointID" json:"-"`
|
|
}
|
|
|
|
func (Endpoint) TableName() string {
|
|
return "endpoints"
|
|
}
|