-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
69 lines (60 loc) · 2.35 KB
/
types.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import "time"
type Profile struct {
Name string `json:"name"`
UserID uint64 `json:"user_id"`
Nickname string `json:"nickname"`
Bio string `json:"bio"`
Work string `json:"work"`
Education string `json:"education"`
CodingSkill string `json:"coding_skill"`
}
type Tag struct {
ID uint64 `json:"id"`
Name string `json:"name" fs:"unique;"`
Description string `json:"description" fs:"optional;"`
Frequency int `json:"frequency" fs:"optional;default=0;sortable;"`
Posts []*Post `json:"posts" fs.relation:"{'type':'m2m','schema':'post','field':'tags','owner':true}"`
}
type Post struct {
ID uint64 `json:"id"`
CoverImage string `json:"cover_image" fs:"optional;"`
Title string `json:"title"`
Content string `json:"content"`
UserID uint64 `json:"user_id"`
Published bool `json:"published" fs:"optional;default=0;sortable"`
PublishedAt *time.Time `json:"published_at,omitempty" fs:"optional;"`
CommentsCount int `json:"comments_count" fs:"optional;default=0;sortable"`
ViewCount int `json:"view_count" fs:"optional;default=0;sortable"`
ShareCount int `json:"share_count" fs:"optional;default=0;sortable"`
TimeToRead int `json:"time_to_read" fs:"optional;default=0"`
UserInteraction bool `json:"user_interaction" fs:"optional;default=0"`
Mode uint `json:"mode"` // Private = 0, Public = 1, Subscriber = 2
Tags []*Tag `json:"tags" fs:"optional;" fs.relation:"{'type':'m2m','schema':'tag','field':'posts','owner':false}"`
}
type Like struct {
_ any `json:"-" fs:"label_field=like"`
ID uint64 `json:"id"`
UserID uint64 `json:"user_id"`
PostID uint64 `json:"post_id"`
}
type Reading struct {
_ any `json:"-" fs:"label_field=reading"`
ID uint64 `json:"id"`
UserID uint64 `json:"user_id"`
PostID uint64 `json:"post_id"`
}
type Follow struct {
_ any `json:"-" fs:"label_field=follow"`
ID uint64 `json:"id"`
FollowedUserID uint64 `json:"followedUser_id"`
FollowingUserID uint64 `json:"followingUser_id" `
}
type Payload struct {
ID int `json:"id"`
Comment string `json:"comment"`
}
type Response struct {
Success bool `json:"success"`
Message string `json:"message"`
}