File tree Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ type Create struct {
6
6
AuthorID uint `json:"authorId"`
7
7
Title string `json:"title"`
8
8
Content string `json:"content"`
9
+ PinOrder * int `json:"pinOrder"`
9
10
}
10
11
11
12
// TODO: Add some validation
@@ -18,5 +19,6 @@ func (params *Create) ToModel() *model.Story {
18
19
AuthorID : params .AuthorID ,
19
20
Title : params .Title ,
20
21
Content : params .Content ,
22
+ PinOrder : params .PinOrder ,
21
23
}
22
24
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ type ListView struct {
6
6
AuthorID uint `json:"authorId"`
7
7
Title string `json:"title"`
8
8
Content string `json:"content"`
9
+ Pinned bool `json:"isPinned"`
9
10
}
10
11
11
12
func ListFrom (stories []model.Story ) []ListView {
@@ -15,6 +16,7 @@ func ListFrom(stories []model.Story) []ListView {
15
16
AuthorID : story .AuthorID ,
16
17
Title : story .Title ,
17
18
Content : story .Content ,
19
+ Pinned : story .PinOrder != nil ,
18
20
}
19
21
}
20
22
return storiesListView
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ type View struct {
7
7
AuthorID uint `json:"authorId"`
8
8
Title string `json:"title"`
9
9
Content string `json:"content"`
10
+ Pinned bool `json:"isPinned"`
10
11
}
11
12
12
13
func SingleFrom (story model.Story ) View {
@@ -15,6 +16,7 @@ func SingleFrom(story model.Story) View {
15
16
AuthorID : story .AuthorID ,
16
17
Title : story .Title ,
17
18
Content : story .Content ,
19
+ Pinned : story .PinOrder != nil ,
18
20
}
19
21
return storyView
20
22
}
You can’t perform that action at this time.
0 commit comments