A community based topic aggregation platform built on atproto

feat(server): wire up comment query API endpoint

Integrate comment query API into server:

- Initialize comment service with repository dependencies
- Register XRPC route: /xrpc/social.coves.community.comment.getComments
- Apply OptionalAuthMiddleware for viewer-specific responses
- Add startup logging for API availability

Route supports:
- Authenticated requests (Bearer token) → viewer state included
- Anonymous requests → public read access
- Query parameters per lexicon spec

Service adapter bridges handler and domain layers for clean separation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

+16
+16
cmd/server/main.go
··· 30 30 _ "github.com/lib/pq" 31 31 "github.com/pressly/goose/v3" 32 32 33 + commentsAPI "Coves/internal/api/handlers/comments" 34 + "Coves/internal/core/comments" 33 35 postgresRepo "Coves/internal/db/postgres" 34 36 ) 35 37 ··· 290 292 commentRepo := postgresRepo.NewCommentRepository(db) 291 293 log.Println("✅ Comment repository initialized (Jetstream indexing only)") 292 294 295 + // Initialize comment service (for query API) 296 + commentService := comments.NewCommentService(commentRepo, userRepo, postRepo) 297 + log.Println("✅ Comment service initialized") 298 + 293 299 // Initialize feed service 294 300 feedRepo := postgresRepo.NewCommunityFeedRepository(db) 295 301 feedService := communityFeeds.NewCommunityFeedService(feedRepo, communityService) ··· 417 423 418 424 routes.RegisterAggregatorRoutes(r, aggregatorService) 419 425 log.Println("Aggregator XRPC endpoints registered (query endpoints public)") 426 + 427 + // Comment query API - supports optional authentication for viewer state 428 + commentServiceAdapter := commentsAPI.NewServiceAdapter(commentService) 429 + commentHandler := commentsAPI.NewGetCommentsHandler(commentServiceAdapter) 430 + r.Handle( 431 + "/xrpc/social.coves.community.comment.getComments", 432 + commentsAPI.OptionalAuthMiddleware(authMiddleware, commentHandler.HandleGetComments), 433 + ) 434 + log.Println("✅ Comment query API registered") 435 + log.Println(" - GET /xrpc/social.coves.community.comment.getComments") 420 436 421 437 r.Get("/health", func(w http.ResponseWriter, r *http.Request) { 422 438 w.WriteHeader(http.StatusOK)