25 lines
710 B
Go
25 lines
710 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Service struct {
|
|
ID uuid.UUID `gorm:"primaryKey;type:uuid;default:gen_random_uuid()" json:"id"`
|
|
Name string `gorm:"not null;unique" json:"name"`
|
|
Description string `gorm:"not null" json:"description"`
|
|
URL *string `json:"url"`
|
|
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"`
|
|
|
|
Webhooks []Webhook `gorm:"foreignKey:ServiceID" json:"webhooks"`
|
|
}
|
|
|
|
func (Service) TableName() string {
|
|
return "services"
|
|
}
|