feat(verification): enforce user verification requirement for posts, comments, and WebSocket connections
Some checks failed
Build Backend / build-docker (push) Has been cancelled
Build Backend / build (push) Has been cancelled

Add verification status checks to protected routes including post creation, updates, deletion, likes, favorites, voting, and WebSocket connections. Also rename RequireVerification middleware to RequireVerified and update error response format with string error codes.
This commit is contained in:
lafay
2026-04-08 02:28:10 +08:00
parent 98b8abd26a
commit ef9a30ee54
7 changed files with 68 additions and 40 deletions

View File

@@ -5,6 +5,7 @@ package main
import (
"carrot_bbs/internal/handler"
"carrot_bbs/internal/repository"
"carrot_bbs/internal/router"
"carrot_bbs/internal/service"
appwire "carrot_bbs/internal/wire"
@@ -24,6 +25,7 @@ func InitializeApp() (*App, error) {
// ProvideRouter 提供路由
func ProvideRouter(
userRepo repository.UserRepository,
userHandler *handler.UserHandler,
postHandler *handler.PostHandler,
commentHandler *handler.CommentHandler,
@@ -58,6 +60,7 @@ func ProvideRouter(
wsHandler *handler.WSHandler,
) *router.Router {
return router.New(
userRepo,
userHandler,
postHandler,
commentHandler,