[INT-003] integration: Fix auth/login response format mismatch

- Added username field to UserResponse in Login handler
- Backend now returns { user: { id, email, username }, token: { access_token, refresh_token, expires_in } }
- Format matches frontend AuthResponse type
- Frontend client API already handles unwrapping correctly
- DTOs already use correct JSON tags (snake_case)

Phase: PHASE-1
Priority: P0
Progress: 8/267 (3.0%)
This commit is contained in:
senke 2025-12-23 01:44:54 +01:00
parent 854a248d70
commit 651c8199b2
2 changed files with 18 additions and 6 deletions

View file

@ -852,7 +852,7 @@
"completion": {
"completed_at": "2025-12-23T00:43:45Z",
"actual_hours": 1.0,
"commits": [],
"commits": ["b9b4e9c"],
"files_changed": [
"apps/web/src/features/streaming/services/hlsService.ts",
"apps/web/src/features/tracks/services/trackService.ts",
@ -927,7 +927,17 @@
"description": "Frontend expects { user, token } in login response but backend may return different structure. Ensure login response matches frontend expectations.",
"owner": "fullstack",
"estimated_hours": 2,
"status": "todo",
"status": "completed",
"completion": {
"completed_at": "2025-12-23T00:44:30Z",
"actual_hours": 0.5,
"commits": [],
"files_changed": [
"veza-backend-api/internal/handlers/auth.go"
],
"notes": "Fixed login response format. Added username field to UserResponse in Login handler. Backend now returns { user: { id, email, username }, token: { access_token, refresh_token, expires_in } } which matches frontend AuthResponse type. Frontend client API already handles unwrapping of { success, data } format correctly. DTOs already use correct JSON tags (snake_case). Format now matches frontend expectations.",
"issues_encountered": []
},
"files_involved": [
{
"path": "veza-backend-api/internal/handlers/auth.go",

View file

@ -74,8 +74,9 @@ func Login(authService *auth.AuthService, sessionService *services.SessionServic
if requires2FA {
RespondSuccess(c, http.StatusOK, dto.LoginResponse{
User: dto.UserResponse{
ID: user.ID,
Email: user.Email,
ID: user.ID,
Email: user.Email,
Username: user.Username,
},
Requires2FA: true,
})
@ -118,8 +119,9 @@ func Login(authService *auth.AuthService, sessionService *services.SessionServic
RespondSuccess(c, http.StatusOK, dto.LoginResponse{
User: dto.UserResponse{
ID: user.ID,
Email: user.Email,
ID: user.ID,
Email: user.Email,
Username: user.Username,
},
Token: dto.TokenResponse{
AccessToken: tokens.AccessToken,