26 lines
786 B
Go
26 lines
786 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Service model structure
|
|
// Represents a public service item.
|
|
type Service struct {
|
|
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
|
|
Title string `gorm:"type:varchar(254);not null" json:"title"`
|
|
Content string `gorm:"type:text" json:"content,omitempty"`
|
|
Image string `gorm:"type:text" json:"image,omitempty"`
|
|
Slug string `gorm:"type:varchar(250);uniqueIndex;not null" json:"slug"`
|
|
IsActive bool `gorm:"default:false" json:"is_active"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// TableName overrides the table name used by Service to `services`
|
|
func (Service) TableName() string {
|
|
return "services"
|
|
}
|