Motivation / 目的
While investigating #540 (mypage does not display after login), we found that the login response (AuthTokenDto) only returns token and token_type — it never returns the user's id. The only existing user-lookup endpoint is GET /v1/users/{id}, which requires the frontend to already know the target id. Since the frontend never learns its own id from the login response, mypage has no way to fetch "my own" user data.
We need a session-based endpoint that resolves the caller's identity from the authenticated Sanctum session, instead of requiring an id in the request.
What needs to be done / 実施内容
- Domain layer: no change needed —
UserRepositroyInterface::findById already exists
- Infra layer: no change needed —
UserRepository::findById is already implemented
- Application layer: no change needed — reuse the existing
GetUserByIdUseCase, passing the id resolved from the authenticated request ($request->user()->id) instead of a route parameter
- Presentation layer:
- Add route
GET /v1/user/me protected by the auth:sanctum middleware
- Add a controller method that resolves the authenticated user's id and calls
GetUserByIdUseCase, returning the result via the existing UserViewModelFactory
Test Results / テスト結果
(to be filled in the corresponding PR)
Motivation / 目的
While investigating #540 (mypage does not display after login), we found that the login response (
AuthTokenDto) only returnstokenandtoken_type— it never returns the user's id. The only existing user-lookup endpoint isGET /v1/users/{id}, which requires the frontend to already know the target id. Since the frontend never learns its own id from the login response, mypage has no way to fetch "my own" user data.We need a session-based endpoint that resolves the caller's identity from the authenticated Sanctum session, instead of requiring an id in the request.
What needs to be done / 実施内容
UserRepositroyInterface::findByIdalready existsUserRepository::findByIdis already implementedGetUserByIdUseCase, passing the id resolved from the authenticated request ($request->user()->id) instead of a route parameterGET /v1/user/meprotected by theauth:sanctummiddlewareGetUserByIdUseCase, returning the result via the existingUserViewModelFactoryTest Results / テスト結果
(to be filled in the corresponding PR)