2025-02-26 22:28:19 +08:00
|
|
|
package database
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type News struct {
|
2025-03-02 04:36:17 +08:00
|
|
|
ID string `gorm:"primaryKey" json:"id"`
|
2025-03-05 21:21:44 +08:00
|
|
|
Title string `json:"title"`
|
|
|
|
|
Content string `json:"content"`
|
2025-03-02 04:36:17 +08:00
|
|
|
Categories []Category `gorm:"many2many:news_categories" json:"categories"`
|
2025-03-05 21:21:44 +08:00
|
|
|
Tags []Tag `gorm:"many2many:news_tags" json:"tags"`
|
2025-03-02 04:36:17 +08:00
|
|
|
IsPremium bool `gorm:"default:false" json:"is_premium"`
|
|
|
|
|
Slug string `gorm:"default:null" json:"slug"`
|
|
|
|
|
FeaturedImage string `gorm:"default:null" json:"featured_image"`
|
2025-03-05 21:21:44 +08:00
|
|
|
AuthorID string `gorm:"not null" json:"author_id"`
|
|
|
|
|
LiveAt time.Time `gorm:"not null" json:"live_at"`
|
2025-03-02 04:36:17 +08:00
|
|
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
2025-03-05 21:21:44 +08:00
|
|
|
DeletedAt time.Time `gorm:"default:null" json:"deleted_at"`
|
2025-02-26 22:28:19 +08:00
|
|
|
}
|