use themes

This commit is contained in:
张超
2025-04-01 17:59:10 +08:00
parent 5934ffd460
commit 577cd10161
13 changed files with 152 additions and 3 deletions

18
models/article.go Normal file
View File

@@ -0,0 +1,18 @@
package models
import "gorm.io/gorm"
type Article struct {
gorm.Model
Title string
Content string `gorm:"type:text"`
AuthorID uint
Tags []Tag `gorm:"many2many:article_tags;"`
}
// Tag represents the tag model
type Tag struct {
gorm.Model
Name string `gorm:"uniqueIndex"` // Ensures tag names are unique
Articles []Article `gorm:"many2many:article_tags;"` // Reverse relationship
}

View File

@@ -8,7 +8,7 @@ package models
import (
"fmt"
"go_blog/conf"
conf "go_blog/config"
"go_blog/pkg/util"
"time"