A community based topic aggregation platform built on atproto
at main 26 lines 1.1 kB view raw
1package routes 2 3import ( 4 "Coves/internal/api/handlers/userblock" 5 "Coves/internal/api/middleware" 6 "Coves/internal/core/userblocks" 7 8 "github.com/go-chi/chi/v5" 9) 10 11// RegisterUserBlockRoutes registers user-to-user blocking XRPC endpoints on the router 12// Implements social.coves.actor.blockUser, unblockUser, and getBlockedUsers 13func RegisterUserBlockRoutes(r chi.Router, service userblocks.Service, authMiddleware *middleware.OAuthAuthMiddleware) { 14 handler := userblock.NewBlockHandler(service) 15 16 // Procedure endpoints (POST) - require authentication 17 // social.coves.actor.blockUser - block a user 18 r.With(authMiddleware.RequireAuth).Post("/xrpc/social.coves.actor.blockUser", handler.HandleBlock) 19 20 // social.coves.actor.unblockUser - unblock a user 21 r.With(authMiddleware.RequireAuth).Post("/xrpc/social.coves.actor.unblockUser", handler.HandleUnblock) 22 23 // Query endpoints (GET) - require authentication (viewing own blocks) 24 // social.coves.actor.getBlockedUsers - list blocked users 25 r.With(authMiddleware.RequireAuth).Get("/xrpc/social.coves.actor.getBlockedUsers", handler.HandleGetBlocked) 26}