Yaojia Wang ec8856ac51 feat(backend): Implement 3 HIGH priority architecture fixes (Phase 2)
Complete Day 8 implementation of HIGH priority gap fixes identified in Day 6 Architecture Gap Analysis.

Changes:
- **Fix 6: Performance Index Migration** - Added composite index (tenant_id, role) on user_tenant_roles table for optimized queries
- **Fix 5: Pagination Enhancement** - Added HasPreviousPage/HasNextPage properties to PagedResultDto
- **Fix 4: ResendVerificationEmail Feature** - Implemented complete resend verification email flow with security best practices

**Fix 6 Details (Performance Index):**
- Created migration: AddUserTenantRolesPerformanceIndex
- Added composite index ix_user_tenant_roles_tenant_role (tenant_id, role)
- Improves query performance for ListTenantUsers with role filtering
- Migration applied successfully to database

**Fix 5 Details (Pagination):**
- Enhanced PagedResultDto with HasPreviousPage and HasNextPage computed properties
- Pagination already fully implemented in ListTenantUsersQuery/Handler
- Supports page/pageSize query parameters in TenantUsersController

**Fix 4 Details (ResendVerificationEmail):**
- Created ResendVerificationEmailCommand and handler
- Added POST /api/auth/resend-verification endpoint
- Security features implemented:
  * Email enumeration prevention (always returns success)
  * Rate limiting (1 email per minute via IRateLimitService)
  * Token rotation (invalidates old token, generates new)
  * SHA-256 token hashing
  * 24-hour expiration
  * Comprehensive audit logging

Test Results:
- All builds succeeded (0 errors, 10 warnings - pre-existing)
- 77 total tests, 64 passed (83.1% pass rate)
- No test regressions from Phase 2 changes
- 9 failing tests are pre-existing invitation workflow tests

Files Modified: 4
Files Created: 4 (2 commands, 2 migrations)
Total Lines Changed: +752/-1

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 23:26:44 +01:00
2025-11-03 22:29:31 +01:00
2025-11-02 23:55:18 +01:00
2025-11-03 11:51:02 +01:00
2025-11-03 20:02:41 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-03 11:51:02 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
2025-11-03 22:29:31 +01:00
2025-11-02 23:55:18 +01:00
2025-11-02 23:55:18 +01:00
Description
No description provided
3.4 MiB
Languages
C# 88.5%
PowerShell 10.4%
Shell 0.8%
Dockerfile 0.3%