feat(verification): add user identity verification system
Implement a complete user identity verification system with support for multiple identity types (student, teacher, staff, alumni). The system includes user-facing verification submission and status checking endpoints, admin endpoints for reviewing verification requests, middleware for protecting verification-required routes, and integration with the user model to track verification status.
This commit is contained in:
@@ -3,6 +3,7 @@ package wire
|
||||
import (
|
||||
"carrot_bbs/internal/handler"
|
||||
"carrot_bbs/internal/pkg/ws"
|
||||
"carrot_bbs/internal/repository"
|
||||
"carrot_bbs/internal/service"
|
||||
|
||||
"github.com/google/wire"
|
||||
@@ -30,6 +31,7 @@ var HandlerSet = wire.NewSet(
|
||||
handler.NewCallHandler,
|
||||
handler.NewReportHandler,
|
||||
handler.NewAdminReportHandler,
|
||||
handler.NewVerificationHandler,
|
||||
|
||||
// 需要特殊处理的 Handler
|
||||
handler.NewUserHandler,
|
||||
@@ -39,6 +41,7 @@ var HandlerSet = wire.NewSet(
|
||||
ProvideGroupHandler,
|
||||
ProvideScheduleHandler,
|
||||
ProvideWSHandler,
|
||||
ProvideAdminVerificationHandler,
|
||||
)
|
||||
|
||||
// ProvideMessageHandler 提供消息处理器
|
||||
@@ -85,3 +88,11 @@ func ProvideWSHandler(
|
||||
) *handler.WSHandler {
|
||||
return handler.NewWSHandler(wsHub, chatService, groupService, jwtService, callService)
|
||||
}
|
||||
|
||||
// ProvideAdminVerificationHandler 提供管理端身份认证处理器
|
||||
func ProvideAdminVerificationHandler(
|
||||
adminVerificationService service.AdminVerificationService,
|
||||
userRepo repository.UserRepository,
|
||||
) *handler.AdminVerificationHandler {
|
||||
return handler.NewAdminVerificationHandler(adminVerificationService, userRepo)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ var RepositorySet = wire.NewSet(
|
||||
repository.NewOperationLogRepository,
|
||||
repository.NewLoginLogRepository,
|
||||
repository.NewDataChangeLogRepository,
|
||||
|
||||
// 身份认证相关仓储
|
||||
repository.NewVerificationRepository,
|
||||
)
|
||||
|
||||
// ProvideUserActivityRepository 提供用户活跃数据仓储
|
||||
|
||||
@@ -58,6 +58,8 @@ var ServiceSet = wire.NewSet(
|
||||
ProvideCallService,
|
||||
ProvideReportService,
|
||||
ProvideAdminReportService,
|
||||
ProvideVerificationService,
|
||||
ProvideAdminVerificationService,
|
||||
|
||||
// 日志服务
|
||||
ProvideAsyncLogManager,
|
||||
@@ -427,3 +429,19 @@ func ProvideAdminReportService(
|
||||
) service.AdminReportService {
|
||||
return service.NewAdminReportService(reportRepo, postRepo, commentRepo, messageRepo, userRepo, notifyRepo, pushService, txManager, logService)
|
||||
}
|
||||
|
||||
// ProvideVerificationService 提供身份认证服务
|
||||
func ProvideVerificationService(
|
||||
verificationRepo repository.VerificationRepository,
|
||||
userRepo repository.UserRepository,
|
||||
) service.VerificationService {
|
||||
return service.NewVerificationService(verificationRepo, userRepo)
|
||||
}
|
||||
|
||||
// ProvideAdminVerificationService 提供管理端身份认证服务
|
||||
func ProvideAdminVerificationService(
|
||||
verificationRepo repository.VerificationRepository,
|
||||
userRepo repository.UserRepository,
|
||||
) service.AdminVerificationService {
|
||||
return service.NewAdminVerificationService(verificationRepo, userRepo)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user