A community based topic aggregation platform built on atproto
1package votes 2 3import "context" 4 5// Repository defines the data access interface for votes 6// Used by Jetstream consumer to index votes from firehose 7// 8// Architecture: Votes are written directly by clients to their PDS using 9// com.atproto.repo.createRecord/deleteRecord. This AppView indexes votes 10// from Jetstream for aggregation and querying. 11type Repository interface { 12 // Create inserts a new vote into the AppView database 13 // Called by Jetstream consumer after vote is created on PDS 14 // Idempotent: ON CONFLICT DO NOTHING for duplicate URIs 15 Create(ctx context.Context, vote *Vote) error 16 17 // GetByURI retrieves a vote by its AT-URI 18 // Used for Jetstream DELETE operations 19 GetByURI(ctx context.Context, uri string) (*Vote, error) 20 21 // GetByVoterAndSubject retrieves a user's vote on a specific subject 22 // Used to check existing vote state 23 GetByVoterAndSubject(ctx context.Context, voterDID, subjectURI string) (*Vote, error) 24 25 // Delete soft-deletes a vote (sets deleted_at) 26 // Called by Jetstream consumer after vote is deleted from PDS 27 Delete(ctx context.Context, uri string) error 28 29 // ListBySubject retrieves all votes on a specific post/comment 30 // Future: Used for vote detail views 31 ListBySubject(ctx context.Context, subjectURI string, limit, offset int) ([]*Vote, error) 32 33 // ListByVoter retrieves all votes by a specific user 34 // Future: Used for user voting history 35 ListByVoter(ctx context.Context, voterDID string, limit, offset int) ([]*Vote, error) 36}