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 10type CommentView struct { 11 Embed interface{} `json:"embed,omitempty"` 12 Record interface{} `json:"record"` 13 Viewer *CommentViewerState `json:"viewer,omitempty"` 14 Author *posts.AuthorView `json:"author"` 15 Post *CommentRef `json:"post"` 16 Parent *CommentRef `json:"parent,omitempty"` 17 Stats *CommentStats `json:"stats"` 18 Content string `json:"content"` 19 CreatedAt string `json:"createdAt"` 20 IndexedAt string `json:"indexedAt"` 21 URI string `json:"uri"` 22 CID string `json:"cid"` 23 ContentFacets []interface{} `json:"contentFacets,omitempty"` 24} 25 26// ThreadViewComment represents a comment with its nested replies 27// Matches social.coves.community.comment.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 Post interface{} `json:"post"` 63 Cursor *string `json:"cursor,omitempty"` 64 Comments []*ThreadViewComment `json:"comments"` 65}