Skip to content

✨[FEAT]: 버블 계정 관리#136

Open
ally010314 wants to merge 2 commits intodevelopfrom
feature/bubble-account
Open

✨[FEAT]: 버블 계정 관리#136
ally010314 wants to merge 2 commits intodevelopfrom
feature/bubble-account

Conversation

@ally010314
Copy link
Contributor

A계정으로 버블 작성 -> 로그아웃 -> TokenManager에 저장된 ID가 없으므로 null을 반환하고 DB에 user_id = null로 저장합니다. A계정으로 작성된 버블이 보이지 않음 (null인 버블만 보이게됨)
B 계정 로그인 -> 로그인 성공 시: UserRepository에서 구글 로그인/회원가입 후 TokenManager에 이메일(userId)을 저장합니다. (user를 유일하게 식별할 수 있으면 되는 거라 이메일도 괜찮다고 생각했어요)
직후 bubbleRepository.linkGuestBubblesToUser를 호출하여 DB에서 user_id가 NULL인 모든 버블을 찾아 방금 로그인한 이메일로 업데이트합니다

BubbleLocal

user_id 컬럼 추가

TokenManager

userId (이메일)를 저장(saveUserId), 로드(loadUserId), 조회(getUserId)하는 기능 추가

BubbleLocalDataSource & Impl

addBubble 함수: userId 파라미터를 받아 저장 시점에 주입하도록 수정했습니다.
(BubbleEntity를 수정하면 수정 사항이 복잡해져서 건드리지 않고
addBubble 함수 내부에서 BubbleLocal 객체를 직접 생성하도록 구현했습니다.)
linkGuestBubblesToUser 함수: UPDATE bubbles SET user_id = ? WHERE user_id IS NULL 쿼리 실행 구현했습니다

BubbleRepositoryImpl

TokenManager를 주입받아 addBubble 시 tokenManager.getUserId()를 호출해 현재 상태(회원/비회원)에 따라 ID를 넘기도록 했습니다

UserRepositoryImpl

BubbleRepository를 주입받아 로그인/회원가입 성공 직후 linkGuestBubblesToUser 호출하도록 했습니다.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ally010314, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 비회원 상태로 작성된 버블 데이터를 로그인한 사용자 계정에 연결하는 기능을 추가합니다. TokenManager를 사용하여 사용자 ID를 관리하고, DB 쿼리를 업데이트하여 기존 버블 데이터를 사용자 계정에 연결합니다. 이를 통해 사용자 경험을 향상시키고 데이터 일관성을 유지합니다.

Highlights

  • 계정 연결 로직: 로그인 시, 로컬 DB에 임시 저장된 버블 데이터를 사용자 계정에 연결합니다. 이를 통해 비회원 상태로 작성된 버블이 로그인 후에도 유지됩니다.
  • TokenManager 활용: TokenManager를 통해 사용자 ID를 저장하고 관리합니다. 이는 버블 데이터와 사용자 계정을 연결하는 데 사용됩니다.
  • BubbleLocalDataSource 수정: addBubble 함수에 userId 파라미터를 추가하여 버블 저장 시 사용자 ID를 함께 저장하도록 변경했습니다.
  • DB 쿼리 업데이트: DB 쿼리를 수정하여 user_id가 NULL인 버블을 찾아 로그인한 사용자의 ID로 업데이트하는 linkGuestBubblesToUser 함수를 구현했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/src/main/java/com/umc/edison/data/datasources/BubbleLocalDataSource.kt
    • addBubble 함수에 userId 파라미터 추가
    • linkGuestBubblesToUser 함수 추가
  • app/src/main/java/com/umc/edison/data/repository/BubbleRepositoryImpl.kt
    • TokenManager 주입
    • linkGuestBubblesToUser 함수 구현
  • app/src/main/java/com/umc/edison/data/repository/UserRepositoryImpl.kt
    • BubbleRepository 주입
    • 로그인/회원가입 성공 시 linkGuestBubblesToUser 호출
  • app/src/main/java/com/umc/edison/data/token/TokenManager.kt
    • userId 저장, 로드, 조회 기능 추가
  • app/src/main/java/com/umc/edison/domain/repository/BubbleRepository.kt
    • linkGuestBubblesToUser 함수 추가
  • app/src/main/java/com/umc/edison/local/datasources/BubbleLocalDataSourceImpl.kt
    • TokenManager 주입
    • addBubble 함수 수정
    • linkGuestBubblesToUser 함수 구현
    • getAllActiveBubbles, getAllRecentBubbles, getAllTrashedBubbles, getActiveBubble, getRawBubble, getBubblesByLabelId, getBubblesWithoutLabel, getSearchBubbleResults 함수 수정
  • app/src/main/java/com/umc/edison/local/model/BubbleLocal.kt
    • userId 컬럼 추가
  • app/src/main/java/com/umc/edison/local/room/dao/BubbleDao.kt
    • linkGuestBubblesToUser 쿼리 추가
    • getAllActiveBubbles, getAllRecentBubbles, getAllTrashedBubbles, getActiveBubbleById, getRawBubbleById, getBubblesByLabelId, getSearchBubbles, getBubblesWithoutLabel, getActiveBubblesByIds 쿼리 수정
Activity
  • ally010314님이 버블 계정 관리 기능 구현
  • ally010314님이 TokenManager에 userId 저장 기능 추가
  • ally010314님이 BubbleLocalDataSource에 addBubble 함수 수정
  • ally010314님이 DB 쿼리 업데이트
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ally010314
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR introduces a feature to link 'bubbles' created by non-members to their account upon member login, effectively managing bubbles per user by introducing user_id. While this is a significant step towards data isolation, two high-severity security issues were identified: a race condition in TokenManager that can lead to data being incorrectly attributed to the wrong user account during app startup, potentially causing cross-user data leakage, and SQL injection vulnerabilities in BaseLocalDataSourceImpl due to string concatenation in raw SQL queries. Additionally, I've provided specific review comments with suggestions for some code de-duplication and readability improvements. Addressing these security issues is critical for ensuring data integrity and user privacy, and incorporating the code suggestions will further enhance the quality of the codebase.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

버블 계정 관리 기능 구현을 위한 변경 사항을 검토했습니다. user_id 컬럼 추가, TokenManager에 사용자 ID 관리 기능 추가, 그리고 BubbleLocalDataSourceBubbleRepository에서 사용자 ID를 활용하여 버블을 저장하고 조회하는 로직이 잘 반영되었습니다. 특히 게스트 버블을 로그인한 사용자에게 연결하는 기능은 사용자 경험을 크게 향상시킬 것으로 보입니다. 전반적으로 기능 구현은 잘 되었으나, 몇 가지 개선 사항이 발견되어 코멘트를 남깁니다.

@ally010314 ally010314 self-assigned this Feb 6, 2026
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