72 lines
1.3 KiB
Go
72 lines
1.3 KiB
Go
package entity
|
|
|
|
// Post is one square entry.
|
|
type Post struct {
|
|
ID int64
|
|
UserID int64
|
|
Kind Kind
|
|
Text string
|
|
Content []byte
|
|
POI POI
|
|
Visibility Visibility
|
|
AuditStatus AuditStatus
|
|
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 square 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.
|
|
type Notice struct {
|
|
ID int64
|
|
ToUserID int64
|
|
FromUserID int64
|
|
Kind NoticeKind
|
|
PostID int64
|
|
CommentID int64
|
|
ReadAtMS int64
|
|
CreatedAtMS int64
|
|
}
|
|
|
|
// NoticeState is per-user read watermark for square notices.
|
|
type NoticeState struct {
|
|
UserID int64
|
|
LastReadNoticeID int64
|
|
UpdatedAtMS int64
|
|
}
|
|
|
|
func DefaultNoticeState(userID int64) *NoticeState {
|
|
return &NoticeState{UserID: userID}
|
|
}
|