A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/community"
5 "Coves/internal/core/communities"
6
7 "github.com/go-chi/chi/v5"
8)
9
10// RegisterCommunityRoutes registers community-related XRPC endpoints on the router
11// Implements social.coves.community.* lexicon endpoints
12func RegisterCommunityRoutes(r chi.Router, service communities.Service) {
13 // Initialize handlers
14 createHandler := community.NewCreateHandler(service)
15 getHandler := community.NewGetHandler(service)
16 updateHandler := community.NewUpdateHandler(service)
17 listHandler := community.NewListHandler(service)
18 searchHandler := community.NewSearchHandler(service)
19 subscribeHandler := community.NewSubscribeHandler(service)
20
21 // Query endpoints (GET)
22 // social.coves.community.get - get a single community by identifier
23 r.Get("/xrpc/social.coves.community.get", getHandler.HandleGet)
24
25 // social.coves.community.list - list communities with filters
26 r.Get("/xrpc/social.coves.community.list", listHandler.HandleList)
27
28 // social.coves.community.search - search communities
29 r.Get("/xrpc/social.coves.community.search", searchHandler.HandleSearch)
30
31 // Procedure endpoints (POST) - write-forward operations
32 // social.coves.community.create - create a new community
33 r.Post("/xrpc/social.coves.community.create", createHandler.HandleCreate)
34
35 // social.coves.community.update - update an existing community
36 r.Post("/xrpc/social.coves.community.update", updateHandler.HandleUpdate)
37
38 // social.coves.community.subscribe - subscribe to a community
39 r.Post("/xrpc/social.coves.community.subscribe", subscribeHandler.HandleSubscribe)
40
41 // social.coves.community.unsubscribe - unsubscribe from a community
42 r.Post("/xrpc/social.coves.community.unsubscribe", subscribeHandler.HandleUnsubscribe)
43
44 // TODO: Add delete handler when implemented
45 // r.Post("/xrpc/social.coves.community.delete", deleteHandler.HandleDelete)
46}