Changed article author to ID only with option to preload

This commit is contained in:
Frederick Holland
2025-10-17 19:07:34 +11:00
parent ee34f9a33f
commit f8e66cc3a6

View File

@@ -2,9 +2,11 @@ package models
type Article struct {
Id string `gorm:"primaryKey" json:"id"`
Author User `json:"author"`
AuthorId string `gorm:"index" json:"author_id"`
Title string `json:"title"`
Sections []ArticleSection `gorm:"serializer:json" json:"sections"`
Author User `gorm:"foreignKey:AuthorId" json:"author"`
}
type ArticleSection struct {