A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/comments"
5 "Coves/internal/api/middleware"
6 commentsCore "Coves/internal/core/comments"
7
8 "github.com/go-chi/chi/v5"
9)
10
11// RegisterCommentRoutes registers comment-related XRPC endpoints on the router
12// Implements social.coves.community.comment.* lexicon endpoints
13// All write operations (create, update, delete) require authentication
14func RegisterCommentRoutes(r chi.Router, service commentsCore.Service, authMiddleware *middleware.OAuthAuthMiddleware) {
15 // Initialize handlers
16 createHandler := comments.NewCreateCommentHandler(service)
17 updateHandler := comments.NewUpdateCommentHandler(service)
18 deleteHandler := comments.NewDeleteCommentHandler(service)
19
20 // Procedure endpoints (POST) - require authentication
21 // social.coves.community.comment.create - create a new comment on a post or another comment
22 r.With(authMiddleware.RequireAuth).Post(
23 "/xrpc/social.coves.community.comment.create",
24 createHandler.HandleCreate)
25
26 // social.coves.community.comment.update - update an existing comment's content
27 r.With(authMiddleware.RequireAuth).Post(
28 "/xrpc/social.coves.community.comment.update",
29 updateHandler.HandleUpdate)
30
31 // social.coves.community.comment.delete - soft delete a comment
32 r.With(authMiddleware.RequireAuth).Post(
33 "/xrpc/social.coves.community.comment.delete",
34 deleteHandler.HandleDelete)
35}