Add stack count/limit to self user responses and document the fields#48
Add stack count/limit to self user responses and document the fields#48
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds stack usage metadata (stack_count, stack_limit) to “self” user API responses (login/me/update-me) and documents the new response fields.
Changes:
- Add
StackService.UserStackSummaryand wire it into/api/auth/login,/api/me, andPUT /api/meresponses. - Extend handler response types/tests to include and assert
stack_count/stack_limit. - Update auth/user docs examples to include the new fields.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/service/stack_service.go | Adds UserStackSummary used to populate stack count/limit in self responses. |
| internal/service/stack_service_test.go | Adds unit test coverage for UserStackSummary. |
| internal/http/handlers/handler.go | Computes stack summary during login/me/update-me and includes it in JSON responses. |
| internal/http/handlers/types.go | Extends userMeResponse and updates newUserMeResponse signature to carry stack fields. |
| internal/http/handlers/handler_test.go | Asserts stack_count/stack_limit in login/me/update-me handler tests. |
| internal/http/handlers/testenv_test.go | Enables stack config in handler test environment. |
| internal/http/integration/testenv_test.go | Enables stack config and asserts stack fields in integration login helper. |
| docs/docs/users.md | Documents stack fields in /api/me and related user docs responses. |
| docs/docs/auth.md | Documents stack fields in /api/auth/login response. |
💡 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.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
💡 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
stack_countandstack_limitin self/me user responses (/api/auth/login,/api/me...).Login
POST /api/auth/loginRequest
{ "email": "user@example.com", "password": "strong-password" }Response 200
{ "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": "고등부", "stack_count": 0, "stack_limit": 3, "blocked_reason": null, "blocked_at": null } }Me
GET /api/meHeaders
Response 200
{ "id": 1, "email": "user@example.com", "username": "user1", "role": "user", "team_id": 1, "team_name": "서울고등학교", "division_id": 2, "division_name": "고등부", "stack_count": 0, "stack_limit": 3, "blocked_reason": null, "blocked_at": null }Errors:
invalid tokenormissing authorizationorinvalid authorizationUpdate Me
PUT /api/meHeaders
Request
{ "username": "new_username" }Response 200
{ "id": 1, "email": "user@example.com", "username": "new_username", "role": "user", "team_id": 1, "team_name": "서울고등학교", "division_id": 2, "division_name": "고등부", "stack_count": 0, "stack_limit": 3, "blocked_reason": null, "blocked_at": null }Errors:
invalid inputinvalid tokenormissing authorizationorinvalid authorizationuser blocked