MVP: 按 07 风格重写前端 + Go 后端落地(长文/短文、编辑器、后台管理)
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package model
|
||||
|
||||
// Post kinds. "long" is a normal article; "short" is a Twitter-like note
|
||||
// with no title shown in the timeline.
|
||||
const (
|
||||
KindLong = "long"
|
||||
KindShort = "short"
|
||||
)
|
||||
|
||||
const (
|
||||
StatusDraft = "draft"
|
||||
StatusPublished = "published"
|
||||
)
|
||||
|
||||
type Post struct {
|
||||
ID int64 `json:"id"`
|
||||
Kind string `json:"kind"`
|
||||
Title string `json:"title"`
|
||||
Slug string `json:"slug"`
|
||||
Summary string `json:"summary"`
|
||||
ContentMd string `json:"content_md,omitempty"`
|
||||
ContentHTML string `json:"content_html"`
|
||||
Status string `json:"status"`
|
||||
PublishedAt string `json:"published_at"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ReadingMinutes int `json:"reading_minutes"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
type PostInput struct {
|
||||
Kind string `json:"kind"`
|
||||
Title string `json:"title"`
|
||||
Slug string `json:"slug"`
|
||||
Summary string `json:"summary"`
|
||||
ContentMd string `json:"content_md"`
|
||||
Status string `json:"status"`
|
||||
PublishedAt string `json:"published_at"`
|
||||
Tags []string `json:"tags"`
|
||||
ReadingMinutes *int `json:"reading_minutes"`
|
||||
}
|
||||
|
||||
type Tag struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ArchiveMonth struct {
|
||||
Month string `json:"month"`
|
||||
Posts []Post `json:"posts"`
|
||||
}
|
||||
|
||||
type ArchiveYear struct {
|
||||
Year string `json:"year"`
|
||||
Months []ArchiveMonth `json:"months"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type Page struct {
|
||||
Items []Post `json:"items"`
|
||||
Total int `json:"total"`
|
||||
Page int `json:"page"`
|
||||
Size int `json:"size"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
SiteTitle string `json:"site_title"`
|
||||
SiteDesc string `json:"site_desc"`
|
||||
AuthorName string `json:"author_name"`
|
||||
AuthorBio string `json:"author_bio"`
|
||||
FooterNote string `json:"footer_note"`
|
||||
ICPLicense string `json:"icp"`
|
||||
PostsPerPage int `json:"posts_per_page"`
|
||||
}
|
||||
Reference in New Issue
Block a user