fix(n+1): 批量查询替代循环单查

- IsAdminBootstrapRequired: userRepo.GetByID 循环 → GetByIDs 批量
- AssignRoles: roleRepo.GetByID 循环 → GetByIDs 批量
- 在 userRepositoryInterface 补充 GetByIDs 方法签名
This commit is contained in:
2026-05-08 08:05:26 +08:00
parent 9b1cea246e
commit 2a18a6fb47
39 changed files with 3169 additions and 393 deletions

View File

@@ -148,6 +148,9 @@ func Serve(cfg *config.Config) error {
// 初始化中间件
rateLimitMiddleware := middleware.NewRateLimitMiddleware(cfg.RateLimit)
stopRateLimitCleanup := rateLimitMiddleware.StartCleanup()
defer stopRateLimitCleanup()
authMiddleware := middleware.NewAuthMiddleware(
jwtManager,
userRepo,