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.community.comment.getComments#commentView lexicon
9// Used in thread views and get endpoints
10// For deleted comments, IsDeleted=true and content-related fields are empty/nil
11type CommentView struct {
12 Embed interface{} `json:"embed,omitempty"`
13 Record interface{} `json:"record"`
14 Viewer *CommentViewerState `json:"viewer,omitempty"`
15 Author *posts.AuthorView `json:"author"`
16 Post *CommentRef `json:"post"`
17 Parent *CommentRef `json:"parent,omitempty"`
18 Stats *CommentStats `json:"stats"`
19 Content string `json:"content"`
20 CreatedAt string `json:"createdAt"`
21 IndexedAt string `json:"indexedAt"`
22 URI string `json:"uri"`
23 CID string `json:"cid"`
24 ContentFacets []interface{} `json:"contentFacets,omitempty"`
25 IsDeleted bool `json:"isDeleted,omitempty"`
26 DeletionReason *string `json:"deletionReason,omitempty"`
27 DeletedAt *string `json:"deletedAt,omitempty"`
28}
29
30// ThreadViewComment represents a comment with its nested replies
31// Matches social.coves.community.comment.getComments#threadViewComment lexicon
32// Supports recursive threading for comment trees
33type ThreadViewComment struct {
34 Comment *CommentView `json:"comment"`
35 Replies []*ThreadViewComment `json:"replies,omitempty"` // Recursive nested replies
36 HasMore bool `json:"hasMore,omitempty"` // Indicates more replies exist
37}
38
39// CommentRef is a minimal reference to a post or comment (URI + CID)
40// Used for threading references (post and parent comment)
41type CommentRef struct {
42 URI string `json:"uri"`
43 CID string `json:"cid"`
44}
45
46// CommentStats represents aggregated statistics for a comment
47// Includes voting metrics and reply counts
48type CommentStats struct {
49 Upvotes int `json:"upvotes"`
50 Downvotes int `json:"downvotes"`
51 Score int `json:"score"`
52 ReplyCount int `json:"replyCount"`
53}
54
55// CommentViewerState represents the viewer's relationship with the comment
56// Includes voting state and vote record reference
57type CommentViewerState struct {
58 Vote *string `json:"vote,omitempty"` // "up" or "down"
59 VoteURI *string `json:"voteUri,omitempty"` // URI of the vote record
60}
61
62// GetCommentsResponse represents the response for fetching comments on a post
63// Matches social.coves.feed.getComments lexicon output
64// Includes the full comment thread tree and original post reference
65type GetCommentsResponse struct {
66 Post interface{} `json:"post"`
67 Cursor *string `json:"cursor,omitempty"`
68 Comments []*ThreadViewComment `json:"comments"`
69}