A community based topic aggregation platform built on atproto
1package votes 2 3import ( 4 "time" 5) 6 7// Vote represents a vote in the AppView database 8// Votes are indexed from the firehose after being written to user repositories 9type Vote struct { 10 ID int64 `json:"id" db:"id"` 11 URI string `json:"uri" db:"uri"` 12 CID string `json:"cid" db:"cid"` 13 RKey string `json:"rkey" db:"rkey"` 14 VoterDID string `json:"voterDid" db:"voter_did"` 15 SubjectURI string `json:"subjectUri" db:"subject_uri"` 16 SubjectCID string `json:"subjectCid" db:"subject_cid"` 17 Direction string `json:"direction" db:"direction"` // "up" or "down" 18 CreatedAt time.Time `json:"createdAt" db:"created_at"` 19 IndexedAt time.Time `json:"indexedAt" db:"indexed_at"` 20 DeletedAt *time.Time `json:"deletedAt,omitempty" db:"deleted_at"` 21} 22 23// CreateVoteRequest represents input for creating a new vote 24// Matches social.coves.interaction.createVote lexicon input schema 25type CreateVoteRequest struct { 26 Subject string `json:"subject"` // AT-URI of post/comment 27 Direction string `json:"direction"` // "up" or "down" 28} 29 30// CreateVoteResponse represents the response from creating a vote 31// Matches social.coves.interaction.createVote lexicon output schema 32type CreateVoteResponse struct { 33 URI string `json:"uri"` // AT-URI of created vote record 34 CID string `json:"cid"` // CID of created vote record 35 Existing *string `json:"existing,omitempty"` // AT-URI of existing vote if updating 36} 37 38// DeleteVoteRequest represents input for deleting a vote 39// Matches social.coves.interaction.deleteVote lexicon input schema 40type DeleteVoteRequest struct { 41 Subject string `json:"subject"` // AT-URI of post/comment 42} 43 44// VoteRecord represents the actual atProto record structure written to PDS 45// This is the data structure that gets stored in the user's repository 46type VoteRecord struct { 47 Type string `json:"$type"` 48 Subject StrongRef `json:"subject"` 49 Direction string `json:"direction"` // "up" or "down" 50 CreatedAt string `json:"createdAt"` 51} 52 53// StrongRef represents a strong reference to a record (URI + CID) 54// Matches the strongRef definition in the vote lexicon 55type StrongRef struct { 56 URI string `json:"uri"` 57 CID string `json:"cid"` 58}