A community based topic aggregation platform built on atproto
1package comments 2 3import ( 4 "time" 5) 6 7// Comment represents a comment in the AppView database 8// Comments are indexed from the firehose after being written to user repositories 9type Comment struct { 10 IndexedAt time.Time `json:"indexedAt" db:"indexed_at"` 11 CreatedAt time.Time `json:"createdAt" db:"created_at"` 12 ContentFacets *string `json:"contentFacets,omitempty" db:"content_facets"` 13 DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"` 14 ContentLabels *string `json:"labels,omitempty" db:"content_labels"` 15 Embed *string `json:"embed,omitempty" db:"embed"` 16 CommenterHandle string `json:"commenterHandle,omitempty" db:"-"` 17 CommenterDID string `json:"commenterDid" db:"commenter_did"` 18 ParentURI string `json:"parentUri" db:"parent_uri"` 19 ParentCID string `json:"parentCid" db:"parent_cid"` 20 Content string `json:"content" db:"content"` 21 RootURI string `json:"rootUri" db:"root_uri"` 22 URI string `json:"uri" db:"uri"` 23 RootCID string `json:"rootCid" db:"root_cid"` 24 CID string `json:"cid" db:"cid"` 25 RKey string `json:"rkey" db:"rkey"` 26 Langs []string `json:"langs,omitempty" db:"langs"` 27 ID int64 `json:"id" db:"id"` 28 UpvoteCount int `json:"upvoteCount" db:"upvote_count"` 29 DownvoteCount int `json:"downvoteCount" db:"downvote_count"` 30 Score int `json:"score" db:"score"` 31 ReplyCount int `json:"replyCount" db:"reply_count"` 32} 33 34// CommentRecord represents the atProto record structure indexed from Jetstream 35// This is the data structure that gets stored in the user's repository 36// Matches social.coves.community.comment lexicon 37type CommentRecord struct { 38 Embed map[string]interface{} `json:"embed,omitempty"` 39 Labels *SelfLabels `json:"labels,omitempty"` 40 Reply ReplyRef `json:"reply"` 41 Type string `json:"$type"` 42 Content string `json:"content"` 43 CreatedAt string `json:"createdAt"` 44 Facets []interface{} `json:"facets,omitempty"` 45 Langs []string `json:"langs,omitempty"` 46} 47 48// ReplyRef represents the threading structure from the comment lexicon 49// Root always points to the original post, parent points to the immediate parent 50type ReplyRef struct { 51 Root StrongRef `json:"root"` 52 Parent StrongRef `json:"parent"` 53} 54 55// StrongRef represents a strong reference to a record (URI + CID) 56// Matches com.atproto.repo.strongRef 57type StrongRef struct { 58 URI string `json:"uri"` 59 CID string `json:"cid"` 60} 61 62// SelfLabels represents self-applied content labels per com.atproto.label.defs#selfLabels 63// This is the structured format used in atProto for content warnings 64type SelfLabels struct { 65 Values []SelfLabel `json:"values"` 66} 67 68// SelfLabel represents a single label value per com.atproto.label.defs#selfLabel 69// Neg is optional and negates the label when true 70type SelfLabel struct { 71 Neg *bool `json:"neg,omitempty"` 72 Val string `json:"val"` 73}