A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/vote"
5 "Coves/internal/api/middleware"
6 "Coves/internal/core/votes"
7
8 "github.com/go-chi/chi/v5"
9)
10
11// RegisterVoteRoutes registers vote-related XRPC endpoints on the router
12// Implements social.coves.interaction.* lexicon endpoints for voting
13func RegisterVoteRoutes(r chi.Router, service votes.Service, authMiddleware *middleware.AtProtoAuthMiddleware) {
14 // Initialize handlers
15 createVoteHandler := vote.NewCreateVoteHandler(service)
16 deleteVoteHandler := vote.NewDeleteVoteHandler(service)
17
18 // Procedure endpoints (POST) - require authentication
19 // social.coves.interaction.createVote - create or toggle a vote on a post/comment
20 r.With(authMiddleware.RequireAuth).Post("/xrpc/social.coves.interaction.createVote", createVoteHandler.HandleCreateVote)
21
22 // social.coves.interaction.deleteVote - delete a vote from a post/comment
23 r.With(authMiddleware.RequireAuth).Post("/xrpc/social.coves.interaction.deleteVote", deleteVoteHandler.HandleDeleteVote)
24}