first commit
This commit is contained in:
30
internal/models/home.go
Normal file
30
internal/models/home.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Home model structure
|
||||
// Includes a many-to-many relation with tags via home_tags.
|
||||
type Home struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
|
||||
Name string `gorm:"type:varchar(254);not null" json:"name"`
|
||||
Title string `gorm:"type:varchar(254);not null" json:"title"`
|
||||
Button1 string `gorm:"type:varchar(254);not null" json:"button1"`
|
||||
Button2 string `gorm:"type:varchar(254);not null" json:"button2"`
|
||||
Video string `gorm:"type:text" json:"video,omitempty"`
|
||||
Keywords string `gorm:"type:varchar(254);not null" json:"keywords"`
|
||||
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"`
|
||||
Tags []Tag `gorm:"many2many:home_tags;" json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// TableName overrides the table name used by Home to `homes`
|
||||
func (Home) TableName() string {
|
||||
return "homes"
|
||||
}
|
||||
Reference in New Issue
Block a user