Skip to content

Align Login API Response with GET /me#47

Merged
yulmwu merged 1 commit intomainfrom
fix/response-unification
Mar 4, 2026
Merged

Align Login API Response with GET /me#47
yulmwu merged 1 commit intomainfrom
fix/response-unification

Conversation

@yulmwu
Copy link
Member

@yulmwu yulmwu commented Mar 4, 2026

Title: Align Login API Response with GET /me

Previously, the login response did not include team-related information. As a result, the frontend could not load the user’s team on the first login, causing solved challenges not to appear correctly.

To resolve this, the login response has been updated so that the user field is consistent with GET /users, as shown below.

type loginUserResponse = userMeResponse

type loginResponse struct {
	AccessToken  string            `json:"access_token"`
	RefreshToken string            `json:"refresh_token"`
	User         loginUserResponse `json:"user"`
}
{
    "access_token": "<jwt>",
    "refresh_token": "<jwt>",
    "user": {
        "id": 1,
        "email": "user@example.com",
        "username": "user1",
        "role": "user",
        "team_id": 3,
        "team_name": "team-alpha",
        "division_id": 2,
        "division_name": "고등부",
        "blocked_reason": null,
        "blocked_at": null
    }
}

@yulmwu yulmwu requested a review from Copilot March 4, 2026 02:29
@yulmwu yulmwu self-assigned this Mar 4, 2026
@yulmwu yulmwu added the bug Something isn't working label Mar 4, 2026
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the auth login response payload so the returned user object matches the richer shape used by the /api/me endpoint, allowing the frontend to reliably load team/division state immediately after first login.

Changes:

  • Replaced the bespoke loginUserResponse struct with a type alias to userMeResponse.
  • Updated the login handler to return newUserMeResponse(user) (including team/division + blocked fields).
  • Strengthened handler/integration tests and updated auth docs to reflect the expanded login response.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/http/integration/testenv_test.go Integration helpers now assert team_id/team_name exist in login responses.
internal/http/handlers/types.go Makes login’s user payload identical to userMeResponse via type alias.
internal/http/handlers/handler_test.go Handler test asserts login response includes the new team/division/blocked fields.
internal/http/handlers/handler.go Login endpoint now reuses newUserMeResponse for response shaping.
docs/docs/auth.md Updates login response example to include team and blocked fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@yulmwu yulmwu merged commit fb142c6 into main Mar 4, 2026
6 checks passed
@yulmwu yulmwu deleted the fix/response-unification branch March 4, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants