A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/actor"
5 "Coves/internal/api/middleware"
6 "Coves/internal/core/blueskypost"
7 "Coves/internal/core/comments"
8 "Coves/internal/core/posts"
9 "Coves/internal/core/users"
10 "Coves/internal/core/votes"
11
12 "github.com/go-chi/chi/v5"
13)
14
15// RegisterActorRoutes registers actor-related XRPC endpoints
16func RegisterActorRoutes(
17 r chi.Router,
18 postService posts.Service,
19 userService users.UserService,
20 voteService votes.Service,
21 blueskyService blueskypost.Service,
22 commentService comments.Service,
23 authMiddleware *middleware.OAuthAuthMiddleware,
24) {
25 // Create handlers
26 getPostsHandler := actor.NewGetPostsHandler(postService, userService, voteService, blueskyService)
27 getCommentsHandler := actor.NewGetCommentsHandler(commentService, userService, voteService)
28
29 // GET /xrpc/social.coves.actor.getPosts
30 // Public endpoint with optional auth for viewer-specific state (vote state)
31 r.With(authMiddleware.OptionalAuth).Get("/xrpc/social.coves.actor.getPosts", getPostsHandler.HandleGetPosts)
32
33 // GET /xrpc/social.coves.actor.getComments
34 // Public endpoint with optional auth for viewer-specific state (vote state)
35 r.With(authMiddleware.OptionalAuth).Get("/xrpc/social.coves.actor.getComments", getCommentsHandler.HandleGetComments)
36}