A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "Coves/internal/api/handlers/adminreport"
5 "Coves/internal/api/middleware"
6 "Coves/internal/core/adminreports"
7 "time"
8
9 "github.com/go-chi/chi/v5"
10)
11
12// RegisterAdminReportRoutes registers admin report XRPC endpoints on the router
13// Implements social.coves.admin.* lexicon endpoints for content reporting
14// All endpoints require authentication and are rate limited
15func RegisterAdminReportRoutes(r chi.Router, service adminreports.Service, authMiddleware *middleware.OAuthAuthMiddleware) {
16 // Initialize handlers
17 submitHandler := adminreport.NewSubmitHandler(service)
18
19 // Create rate limiter for report submission
20 // Allow 10 reports per minute per user to prevent abuse
21 // This is intentionally restrictive since report submission is a sensitive operation
22 reportRateLimiter := middleware.NewRateLimiter(10, time.Minute)
23
24 // Procedure endpoints (POST) - require authentication and rate limiting
25 // social.coves.admin.submitReport - submit a report for admin review
26 r.With(
27 reportRateLimiter.Middleware,
28 authMiddleware.RequireAuth,
29 ).Post(
30 "/xrpc/social.coves.admin.submitReport",
31 submitHandler.HandleSubmit)
32}