feat(15-01): add journal categories, tags, settings, and author slug

Squash the remaining golem15_journal_* tables plus the backend_users
author slug so a host migrate matches the frozen PHP schema.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-06 18:28:17 +02:00
parent 445022ef71
commit 9ae4b9141e
11 changed files with 420 additions and 0 deletions

View File

@@ -2,6 +2,9 @@ package models
import (
"time"
"git.golem15.com/golem15/summercms/modules/cabana"
"git.golem15.com/golem15/summercms/modules/lagoon/attach"
)
// Post is a journal entry stored on golem15_journal_posts.
@@ -21,6 +24,10 @@ type Post struct {
Sources *string `gorm:"column:sources;type:jsonb"`
CreatedAt *time.Time `gorm:"column:created_at"`
UpdatedAt *time.Time `gorm:"column:updated_at"`
User *cabana.BackendUser `gorm:"foreignKey:UserID" json:"-"`
Categories []Category `gorm:"many2many:golem15_journal_posts_categories;" json:"-"`
Tags []Tag `gorm:"many2many:golem15_journal_posts_tags;" json:"-"`
}
func (Post) TableName() string { return "golem15_journal_posts" }
@@ -43,6 +50,13 @@ func (Post) Fillable() []string {
}
}
func (Post) AttachRelations() []attach.Relation {
return []attach.Relation{
{Name: "featured_images", Many: true, Public: true},
{Name: "content_images", Many: true, Public: true},
}
}
func init() {
Register(Post{})
}