Skip to content

fix: user not found error at first signin#605

Open
dawnfire05 wants to merge 1 commit into
gsainfoteam:developmentfrom
dawnfire05:598-fix-groups-login---user-not-found
Open

fix: user not found error at first signin#605
dawnfire05 wants to merge 1 commit into
gsainfoteam:developmentfrom
dawnfire05:598-fix-groups-login---user-not-found

Conversation

@dawnfire05

@dawnfire05 dawnfire05 commented Aug 13, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • 새로운 기능
    • 토큰 기반 로그인 엔드포인트를 추가해 액세스 토큰으로 바로 로그인할 수 있습니다.
    • 로그인 직후 서버와 자동 동기화되어 세션/권한/설정 등이 즉시 반영됩니다.
    • 기존 정보 조회 기능은 변경 없이 그대로 제공됩니다.

@coderabbitai

coderabbitai Bot commented Aug 13, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

토큰 기반 로그인 엔드포인트가 추가되었고, Retrofit 주석(@get, @query)으로 통합되었습니다. BaseAuthApi에 login 메서드가 도입되었으며, User/Auth API 구현에 해당 메서드가 추가되었습니다. RestAuthRepository.login() 흐름에 액세스 토큰 저장 후 _api.login(accessToken) 호출이 삽입되었습니다.

Changes

Cohort / File(s) Summary
Auth API Base 인터페이스
lib/app/modules/auth/data/data_sources/remote/base_auth_api.dart
Retrofit 의존성 추가 및 Future login(@Query('token') String token); 메서드 선언 추가. 기존 info() 유지.
User/Auth 원격 API 구현
lib/app/modules/user/data/data_sources/remote/auth_api.dart, lib/app/modules/user/data/data_sources/remote/user_api.dart
@GET('login') + @Query('token') 기반의 Future<void> login(...) 메서드 추가 및 BaseAuthApi의 메서드 오버라이드.
인증 리포지토리
lib/app/modules/user/data/repositories/rest_auth_repository.dart
login() 내부에서 토큰 저장 후 _api.login(token.accessToken) 비동기 호출 추가. 기존 로직 변경 없음.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant App as App UI
  participant Repo as RestAuthRepository
  participant OAuth as OAuth Provider
  participant Storage as Token Storage
  participant API as Auth/User API
  participant Server as Backend

  User->>App: 로그인 요청
  App->>Repo: login(credentials)
  Repo->>OAuth: 토큰 발급 요청
  OAuth-->>Repo: accessToken (+ refreshToken)
  Repo->>Storage: 토큰 저장
  Repo->>API: login(accessToken as query)
  API->>Server: GET /login?token=accessToken
  Server-->>API: 200 OK
  API-->>Repo: 완료
  Repo-->>App: 로그인 완료
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

토큰을 품고 깡총깡총 달려가,
GET 한 줄로 문을 콩콩 두드려요.
저장된 열쇠로 로그인 탁!
서버는 끄덕, 응답은 착.
오늘도 레트로핏과 나는, 버그 없이 신속착착! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/app/modules/auth/data/data_sources/remote/base_auth_api.dart (1)

4-4: 반환 타입의 일관성을 확인해주세요.

베이스 클래스에서는 제네릭 Future를 사용하고 있지만, 구현체들에서는 Future<void>를 사용하고 있습니다. 일관성을 위해 베이스 클래스도 Future<void>로 변경하는 것을 고려해보세요.

-  Future login(@Query('token') String token);
+  Future<void> login(@Query('token') String token);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86f53f7 and 6cc44b0.

📒 Files selected for processing (4)
  • lib/app/modules/auth/data/data_sources/remote/base_auth_api.dart (1 hunks)
  • lib/app/modules/user/data/data_sources/remote/auth_api.dart (1 hunks)
  • lib/app/modules/user/data/data_sources/remote/user_api.dart (1 hunks)
  • lib/app/modules/user/data/repositories/rest_auth_repository.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build Android App and Test
  • GitHub Check: Build iOS App and Test
🔇 Additional comments (3)
lib/app/modules/user/data/data_sources/remote/auth_api.dart (1)

16-18: 새로운 로그인 엔드포인트가 올바르게 구현되었습니다.

베이스 API의 메서드를 적절히 오버라이드했으며, Retrofit 어노테이션도 정확합니다. 반환 타입도 Future<void>로 명확하게 정의되어 있습니다.

lib/app/modules/auth/data/data_sources/remote/base_auth_api.dart (1)

1-1: Retrofit 통합을 위한 import가 추가되었습니다.

새로운 로그인 메서드의 @Query 어노테이션을 위해 필요한 import입니다.

lib/app/modules/user/data/data_sources/remote/user_api.dart (1)

16-18: UserApi의 로그인 엔드포인트가 올바르게 구현되었습니다.

베이스 API를 적절히 오버라이드했으며, Retrofit 어노테이션과 쿼리 파라미터 설정이 정확합니다.

if (token.refreshToken != null) {
await _tokenRepository.saveRefreshToken(token.refreshToken!);
}
await _api.login(token.accessToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

새로운 API 호출에 대한 에러 핸들링을 추가해주세요.

토큰 저장 후 추가된 _api.login(token.accessToken) 호출이 실패할 경우를 대비한 에러 핸들링이 필요합니다. 이 호출이 실패하더라도 사용자가 로그인 상태를 유지할 수 있도록 처리하거나, 실패 시 적절한 롤백 로직을 구현해야 합니다.

다음과 같이 에러 핸들링을 추가하는 것을 권장합니다:

  await _tokenRepository.saveToken(token.accessToken);
  if (token.refreshToken != null) {
    await _tokenRepository.saveRefreshToken(token.refreshToken!);
  }
- await _api.login(token.accessToken);
+ try {
+   await _api.login(token.accessToken);
+ } catch (e) {
+   // API 호출 실패 시 로깅하지만 로그인은 계속 진행
+   // 또는 필요에 따라 토큰을 롤백할 수 있음
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await _api.login(token.accessToken);
await _tokenRepository.saveToken(token.accessToken);
if (token.refreshToken != null) {
await _tokenRepository.saveRefreshToken(token.refreshToken!);
}
- await _api.login(token.accessToken);
+ try {
+ await _api.login(token.accessToken);
+ } catch (e) {
+ // API 호출 실패 시 로깅하지만 로그인은 계속 진행
+ // 또는 필요에 따라 토큰을 롤백할 수 있음
+ }
🤖 Prompt for AI Agents
In lib/app/modules/user/data/repositories/rest_auth_repository.dart around line
31, the new await _api.login(token.accessToken) call lacks error handling; wrap
this call in a try/catch so the repository handles failures: either swallow the
error (log it) and return success so the saved token keeps the user logged in,
or perform a rollback by deleting the stored token and rethrowing or returning a
failure result; ensure you log the error and choose a clear contract
(bool/result) so callers know whether login finalization succeeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant