Add authenticated content editing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Daniel Noulet 2026-09-19 14:56:49 +02:00
parent fac7588d23
commit fd2877da9e
15 changed files with 581 additions and 37 deletions

View file

@ -8,9 +8,37 @@ type UserModel struct {
Name string
Provider string `gorm:"not null"`
ProviderSubject string `gorm:"uniqueIndex;not null"`
Role string `gorm:"not null;default:''"`
Editor bool `gorm:"not null;default:false"`
CreatedAt time.Time
}
type ContentModel struct {
ID uint `gorm:"primaryKey"`
Slug string `gorm:"uniqueIndex;not null"`
Title string `gorm:"not null"`
Summary string
Body string `gorm:"not null"`
Status string `gorm:"not null;default:'draft'"`
Published bool `gorm:"not null;default:false"`
CreatedAt, UpdatedAt time.Time
CreatedBy, UpdatedBy uint
}
func (ContentModel) TableName() string { return "content" }
type ContentHistoryModel struct {
ID uint `gorm:"primaryKey"`
ContentID uint `gorm:"index;not null"`
Operation string `gorm:"not null"`
ActorID *uint
ActorAdminID *uint
CreatedAt time.Time
Snapshot string `gorm:"type:jsonb;not null"`
}
func (ContentHistoryModel) TableName() string { return "content_history" }
func (UserModel) TableName() string { return "users" }
type AdminModel struct {