-
Notifications
You must be signed in to change notification settings - Fork 3
/
article_model.go
36 lines (33 loc) · 1.11 KB
/
article_model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package model
import (
"github.com/google/uuid"
"time"
)
// Article represents a piece of writing about a
// particular subject in my website's archive.
type Article struct {
UUID uuid.UUID `json:"uuid"`
Title string `json:"title"`
Slug string `json:"slug"`
Author string `json:"author"`
Views int64 `json:"views"`
ReadTime int `json:"read_time"`
IsDraft bool `json:"is_draft"`
IsPinned bool `json:"is_pinned"`
PublishedAt *time.Time `json:"published_at"`
ModifiedAt *time.Time `json:"modified_at"`
DraftedAt time.Time `json:"drafted_at"`
UpdatedAt time.Time `json:"updated_at"`
Topic *Topic `json:"topic"`
Tags []*Tag `json:"tags"`
Content string `json:"content"`
}
// ArticlePatch is a patch for a published article.
type ArticlePatch struct {
ArticleUUID uuid.UUID `json:"article_uuid"`
Title *string `json:"title"`
Slug *string `json:"slug"`
ReadTime *int `json:"-"`
TopicID *string `json:"topic_id"`
Content *string `json:"content"`
}