81 lines
1.6 KiB
Go
81 lines
1.6 KiB
Go
package entity
|
|
|
|
// Post is one Moments entry. Content is JSON bytes of images/video keys, never media bytes.
|
|
type Post struct {
|
|
ID int64
|
|
UserID int64
|
|
Kind Kind
|
|
Text string
|
|
Content []byte
|
|
POI POI
|
|
Visibility Visibility
|
|
Status Status
|
|
LikeCount int
|
|
CommentCount int
|
|
CreatedAtMS int64
|
|
}
|
|
|
|
// POI is an optional location pin.
|
|
type POI struct {
|
|
Lat float64
|
|
Lng float64
|
|
Name string
|
|
Address string
|
|
}
|
|
|
|
func (p POI) Set() bool {
|
|
return p.Name != "" || p.Address != "" || p.Lat != 0 || p.Lng != 0
|
|
}
|
|
|
|
// Like is one (post, user) edge.
|
|
type Like struct {
|
|
PostID int64
|
|
UserID int64
|
|
CreatedAtMS int64
|
|
}
|
|
|
|
// Comment is one Moments comment or reply.
|
|
type Comment struct {
|
|
ID int64
|
|
PostID int64
|
|
UserID int64
|
|
ReplyToID int64
|
|
ReplyToUID int64
|
|
Text string
|
|
Status Status
|
|
CreatedAtMS int64
|
|
}
|
|
|
|
// Notice is a like/comment notification for one receiver.
|
|
type Notice struct {
|
|
ID int64
|
|
ToUserID int64
|
|
FromUserID int64
|
|
Kind NoticeKind
|
|
PostID int64
|
|
CommentID int64
|
|
ReadAtMS int64
|
|
CreatedAtMS int64
|
|
}
|
|
|
|
// Settings is per-user Moments prefs. Zero value is the documented default.
|
|
type Settings struct {
|
|
UserID int64
|
|
CoverKey string
|
|
VisibleDays VisibleDays
|
|
LastReadPostID int64
|
|
UpdatedAtMS int64
|
|
}
|
|
|
|
// Hide is a directed "don't look / don't let look" edge.
|
|
type Hide struct {
|
|
UserID int64
|
|
PeerID int64
|
|
HideHim bool
|
|
HideMe bool
|
|
}
|
|
|
|
func DefaultSettings(userID int64) *Settings {
|
|
return &Settings{UserID: userID}
|
|
}
|