A community based topic aggregation platform built on atproto
1package posts
2
3import (
4 "time"
5)
6
7// Post represents a post in the AppView database
8// Posts are indexed from the firehose after being written to community repositories
9type Post struct {
10 CreatedAt time.Time `json:"createdAt" db:"created_at"`
11 IndexedAt time.Time `json:"indexedAt" db:"indexed_at"`
12 EditedAt *time.Time `json:"editedAt,omitempty" db:"edited_at"`
13 Embed *string `json:"embed,omitempty" db:"embed"`
14 DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"`
15 ContentLabels *string `json:"contentLabels,omitempty" db:"content_labels"`
16 Title *string `json:"title,omitempty" db:"title"`
17 Content *string `json:"content,omitempty" db:"content"`
18 ContentFacets *string `json:"contentFacets,omitempty" db:"content_facets"`
19 CID string `json:"cid" db:"cid"`
20 CommunityDID string `json:"communityDid" db:"community_did"`
21 RKey string `json:"rkey" db:"rkey"`
22 URI string `json:"uri" db:"uri"`
23 AuthorDID string `json:"authorDid" db:"author_did"`
24 ID int64 `json:"id" db:"id"`
25 UpvoteCount int `json:"upvoteCount" db:"upvote_count"`
26 DownvoteCount int `json:"downvoteCount" db:"downvote_count"`
27 Score int `json:"score" db:"score"`
28 CommentCount int `json:"commentCount" db:"comment_count"`
29}
30
31// CreatePostRequest represents input for creating a new post
32// Matches social.coves.post.create lexicon input schema
33type CreatePostRequest struct {
34 OriginalAuthor interface{} `json:"originalAuthor,omitempty"`
35 FederatedFrom interface{} `json:"federatedFrom,omitempty"`
36 Location interface{} `json:"location,omitempty"`
37 Title *string `json:"title,omitempty"`
38 Content *string `json:"content,omitempty"`
39 Embed map[string]interface{} `json:"embed,omitempty"`
40 Community string `json:"community"`
41 AuthorDID string `json:"authorDid"`
42 Facets []interface{} `json:"facets,omitempty"`
43 ContentLabels []string `json:"contentLabels,omitempty"`
44}
45
46// CreatePostResponse represents the response from creating a post
47// Matches social.coves.post.create lexicon output schema
48type CreatePostResponse struct {
49 URI string `json:"uri"` // AT-URI of created post
50 CID string `json:"cid"` // CID of created post
51}
52
53// PostRecord represents the actual atProto record structure written to PDS
54// This is the data structure that gets stored in the community's repository
55type PostRecord struct {
56 OriginalAuthor interface{} `json:"originalAuthor,omitempty"`
57 FederatedFrom interface{} `json:"federatedFrom,omitempty"`
58 Location interface{} `json:"location,omitempty"`
59 Title *string `json:"title,omitempty"`
60 Content *string `json:"content,omitempty"`
61 Embed map[string]interface{} `json:"embed,omitempty"`
62 Type string `json:"$type"`
63 Community string `json:"community"`
64 Author string `json:"author"`
65 CreatedAt string `json:"createdAt"`
66 Facets []interface{} `json:"facets,omitempty"`
67 ContentLabels []string `json:"contentLabels,omitempty"`
68}