A community based topic aggregation platform built on atproto
1package comments
2
3import (
4 "Coves/internal/core/posts"
5)
6
7// CommentView represents the full view of a comment with all metadata
8// Matches social.coves.feed.getComments#commentView lexicon
9// Used in thread views and get endpoints
10type CommentView struct {
11 URI string `json:"uri"`
12 CID string `json:"cid"`
13 Author *posts.AuthorView `json:"author"`
14 Record interface{} `json:"record"` // Original record verbatim
15 Post *CommentRef `json:"post"` // Reference to parent post
16 Parent *CommentRef `json:"parent,omitempty"` // Parent comment if nested
17 Content string `json:"content"`
18 ContentFacets []interface{} `json:"contentFacets,omitempty"`
19 Embed interface{} `json:"embed,omitempty"`
20 CreatedAt string `json:"createdAt"` // RFC3339
21 IndexedAt string `json:"indexedAt"` // RFC3339
22 Stats *CommentStats `json:"stats"`
23 Viewer *CommentViewerState `json:"viewer,omitempty"`
24}
25
26// ThreadViewComment represents a comment with its nested replies
27// Matches social.coves.feed.getComments#threadViewComment lexicon
28// Supports recursive threading for comment trees
29type ThreadViewComment struct {
30 Comment *CommentView `json:"comment"`
31 Replies []*ThreadViewComment `json:"replies,omitempty"` // Recursive nested replies
32 HasMore bool `json:"hasMore,omitempty"` // Indicates more replies exist
33}
34
35// CommentRef is a minimal reference to a post or comment (URI + CID)
36// Used for threading references (post and parent comment)
37type CommentRef struct {
38 URI string `json:"uri"`
39 CID string `json:"cid"`
40}
41
42// CommentStats represents aggregated statistics for a comment
43// Includes voting metrics and reply counts
44type CommentStats struct {
45 Upvotes int `json:"upvotes"`
46 Downvotes int `json:"downvotes"`
47 Score int `json:"score"`
48 ReplyCount int `json:"replyCount"`
49}
50
51// CommentViewerState represents the viewer's relationship with the comment
52// Includes voting state and vote record reference
53type CommentViewerState struct {
54 Vote *string `json:"vote,omitempty"` // "up" or "down"
55 VoteURI *string `json:"voteUri,omitempty"` // URI of the vote record
56}
57
58// GetCommentsResponse represents the response for fetching comments on a post
59// Matches social.coves.feed.getComments lexicon output
60// Includes the full comment thread tree and original post reference
61type GetCommentsResponse struct {
62 Comments []*ThreadViewComment `json:"comments"`
63 Post interface{} `json:"post"` // PostView from post handler
64 Cursor *string `json:"cursor,omitempty"` // Pagination cursor
65}