数据结构优化
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Post 博客文章模型
|
||||
type Post struct {
|
||||
ID uint `json:"id"`
|
||||
OriginalID string `json:"originalId,omitempty"` // For backward compatibility
|
||||
Title string `json:"title"`
|
||||
Category string `json:"category"`
|
||||
Date string `json:"date"` // YYYY-MM-DD
|
||||
Excerpt string `json:"excerpt"`
|
||||
Content string `json:"content"`
|
||||
ReadCount uint `json:"readCount"`
|
||||
IsPublished int `json:"isPublished"` // 0: draft, 1: published
|
||||
Tags []Tag `json:"tags"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID uint `json:"id"`
|
||||
OriginalID string `json:"originalId,omitempty"` // For backward compatibility
|
||||
Title string `json:"title"`
|
||||
Category string `json:"category"`
|
||||
// Date Removed from DB
|
||||
Excerpt string `json:"excerpt"`
|
||||
Content string `json:"content"`
|
||||
ReadCount uint `json:"readCount"`
|
||||
IsPublished int `json:"isPublished"` // 0: draft, 1: published
|
||||
Tags []Tag `json:"tags"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
UpdatedAt int64 `json:"updatedAt"`
|
||||
DeletedAt int64 `json:"deletedAt"`
|
||||
}
|
||||
|
||||
// PostResponse 博客文章响应模型
|
||||
@@ -32,34 +29,35 @@ type PostResponse struct {
|
||||
|
||||
// Tag 标签模型
|
||||
type Tag struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
UpdatedAt int64 `json:"updatedAt"`
|
||||
DeletedAt int64 `json:"deletedAt"`
|
||||
}
|
||||
|
||||
// PostTag 文章标签关联模型
|
||||
type PostTag struct {
|
||||
PostID string `json:"postId"`
|
||||
TagID uint `json:"tagId"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
PostID string `json:"postId"`
|
||||
TagID uint `json:"tagId"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
}
|
||||
|
||||
// PostHistory 文章历史记录模型
|
||||
type PostHistory struct {
|
||||
ID uint `json:"id"`
|
||||
PostID uint `json:"postId"`
|
||||
Version int `json:"version"`
|
||||
Title string `json:"title"`
|
||||
Category string `json:"category"`
|
||||
Date string `json:"date"`
|
||||
Excerpt string `json:"excerpt"`
|
||||
Content string `json:"content"`
|
||||
IsPublished int `json:"isPublished"`
|
||||
ModifiedBy uint `json:"modifiedBy"`
|
||||
ModifiedAt time.Time `json:"modifiedAt"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID uint `json:"id"`
|
||||
PostID uint `json:"postId"`
|
||||
Version int `json:"version"`
|
||||
Title string `json:"title"`
|
||||
Category string `json:"category"`
|
||||
// Date Removed
|
||||
Excerpt string `json:"excerpt"`
|
||||
Content string `json:"content"`
|
||||
IsPublished int `json:"isPublished"`
|
||||
ModifiedBy uint `json:"modifiedBy"`
|
||||
ModifiedAt int64 `json:"modifiedAt"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
}
|
||||
|
||||
// PostHistoryResponse 文章历史记录响应模型
|
||||
|
||||
Reference in New Issue
Block a user