A community based topic aggregation platform built on atproto
1package votes 2 3import ( 4 "context" 5 "time" 6) 7 8// SubjectValidator validates that vote subjects (posts/comments) exist 9// This prevents creating votes on non-existent content 10type SubjectValidator interface { 11 // SubjectExists checks if a post or comment exists at the given URI 12 // Returns true if found, false if not found 13 SubjectExists(ctx context.Context, uri string) (bool, error) 14} 15 16// Vote represents a vote in the AppView database 17// Votes are indexed from the firehose after being written to user repositories 18type Vote struct { 19 CreatedAt time.Time `json:"createdAt" db:"created_at"` 20 IndexedAt time.Time `json:"indexedAt" db:"indexed_at"` 21 DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"` 22 URI string `json:"uri" db:"uri"` 23 CID string `json:"cid" db:"cid"` 24 RKey string `json:"rkey" db:"rkey"` 25 VoterDID string `json:"voterDid" db:"voter_did"` 26 SubjectURI string `json:"subjectUri" db:"subject_uri"` 27 SubjectCID string `json:"subjectCid" db:"subject_cid"` 28 Direction string `json:"direction" db:"direction"` 29 ID int64 `json:"id" db:"id"` 30} 31 32// VoteRecord represents the atProto record structure indexed from Jetstream 33// This is the data structure that gets stored in the user's repository 34type VoteRecord struct { 35 Type string `json:"$type"` 36 Subject StrongRef `json:"subject"` 37 Direction string `json:"direction"` // "up" or "down" 38 CreatedAt string `json:"createdAt"` 39} 40 41// StrongRef represents a strong reference to a record (URI + CID) 42// Matches the strongRef definition in the vote lexicon 43type StrongRef struct { 44 URI string `json:"uri"` 45 CID string `json:"cid"` 46}