Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RF] move userMusicFromList to GameApiController and add GenericUserM… #102

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

clansty
Copy link
Collaborator

@clansty clansty commented Jan 5, 2025

…usicRepo

Summary by Sourcery

重构用户音乐检索逻辑,将其从单个游戏控制器移动到 GameApiController,并引入通用的 GenericUserMusicRepo 接口。

新特性:

  • 添加新的 API 端点,根据音乐 ID 列表检索用户音乐数据。

增强:

  • 引入 GenericUserMusic 接口和 GenericUserMusicRepo,以处理不同游戏中的用户音乐数据。
  • userMusicFromList API 端点移动到 GameApiController,提供集中的实现。
Original summary in English

Summary by Sourcery

Refactor the user music retrieval logic by moving it from individual game controllers to the GameApiController and introducing a generic GenericUserMusicRepo interface.

New Features:

  • Add a new API endpoint to retrieve user music data based on a list of music IDs.

Enhancements:

  • Introduce a GenericUserMusic interface and GenericUserMusicRepo to handle user music data across different games.
  • Move the userMusicFromList API endpoint to the GameApiController to provide a centralized implementation.

Copy link
Contributor

sourcery-ai bot commented Jan 5, 2025

审阅者指南 by Sourcery

这个拉取请求通过将 userMusicFromList 函数移动到 GameApiController 并引入新的 GenericUserMusicRepo 接口来重构用户音乐检索逻辑。

新的 GenericUserMusicRepo 层次结构的类图

classDiagram
    class IGenericUserMusic {
      <<interface>>
      +musicId: Int
    }

    class GenericUserMusicRepo~T~ {
      <<interface>>
      +findByUserCardExtId(extId: Long): List~T~
      +findByUser_Card_ExtIdAndMusicIdIn(userId: Long, musicId: List~Int~): List~T~
    }

    class Mai2UserMusicDetail {
      +override musicId: Int
      +level: Int
      +playCount: Int
      +achievement: Int
    }

    class UserMusicDetail {
      +override musicId: Int
      +level: Int
      +playCount: Int
      +scoreMax: Int
    }

    class WcUserScore {
      +override musicId: Int
      +level: Int
      +achievement: Int
    }

    IGenericUserMusic <|.. Mai2UserMusicDetail
    IGenericUserMusic <|.. UserMusicDetail
    IGenericUserMusic <|.. WcUserScore
    GenericUserMusicRepo <|.. Mai2UserMusicDetailRepo
    GenericUserMusicRepo <|.. Chu3UserMusicDetailRepo
    GenericUserMusicRepo <|.. WcUserBestScoreRepo

    note for IGenericUserMusic "新的具有音乐ID的实体接口"
Loading

GameApiController 变更的类图

classDiagram
    class GameApiController~T~ {
      +name: String
      +us: AquaUserServices
      +userDataRepo: GenericUserDataRepo~T~
      +playlogRepo: GenericPlaylogRepo~*~
      +userMusicRepo: GenericUserMusicRepo~*~
      +userMusicFromList(username: String, musicList: List~Int~)
    }

    class Maimai2 {
      +userMusicRepo: Mai2UserMusicDetailRepo
    }

    class Chusan {
      +userMusicRepo: Chu3UserMusicDetailRepo
    }

    class Wacca {
      +userMusicRepo: WcUserBestScoreRepo
    }

    class Ongeki {
      +userMusicRepo: UserMusicDetailRepository
    }

    GameApiController <|-- Maimai2
    GameApiController <|-- Chusan
    GameApiController <|-- Wacca
    GameApiController <|-- Ongeki

    note for GameApiController "添加了 userMusicRepo 并将 userMusicFromList 移至此处"
Loading

文件级变更

变更 详情 文件
userMusicFromList 函数移动到 GameApiController
  • GameApiController 中添加 userMusicFromList 函数。
  • Maimai2 类中删除 userMusicFromList 函数。
  • GameApiController 中添加 userMusicRepo 属性。
src/main/java/icu/samnyan/aqua/net/games/GameApiController.kt
src/main/java/icu/samnyan/aqua/net/games/mai2/Maimai2.kt
引入 GenericUserMusicRepo 接口
  • 创建 IGenericUserMusic 接口。
  • 创建扩展 JpaRepositoryGenericUserMusicRepo 接口。
  • Mai2UserMusicDetailRepoChu3UserMusicDetailRepoWcUserBestScoreRepoUserMusicDetailRepository 中实现 GenericUserMusicRepo
  • GenericUserMusicRepo 中添加 findByUserCardExtIdfindByUser_Card_ExtIdAndMusicIdIn 方法。
src/main/java/icu/samnyan/aqua/net/games/Models.kt
src/main/java/icu/samnyan/aqua/sega/maimai2/model/Repos.kt
src/main/java/icu/samnyan/aqua/sega/chusan/model/Chu3Repos.kt
src/main/java/icu/samnyan/aqua/sega/wacca/model/db/Repos.kt
src/main/java/icu/samnyan/aqua/sega/ongeki/dao/userdata/UserMusicDetailRepository.java
在各种用户音乐详情类中实现 IGenericUserMusic 接口
  • UserMusicDetailMai2UserMusicDetailWcUserScoreUserMusicDetail 类中实现 IGenericUserMusic
  • 如果尚未存在,则在实现类中添加 musicId 属性。
src/main/java/icu/samnyan/aqua/sega/chusan/model/userdata/UserMusicDetail.kt
src/main/java/icu/samnyan/aqua/sega/maimai2/model/userdata/UserEntities.kt
src/main/java/icu/samnyan/aqua/sega/wacca/model/db/WaccaUserModels.kt
src/main/java/icu/samnyan/aqua/sega/ongeki/model/userdata/UserMusicDetail.java

提示和命令

与 Sourcery 交互

  • 触发新的审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复审阅评论,要求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题的任何位置写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何位置写 @sourcery-ai summary 以随时生成 PR 摘要。您还可以使用此命令指定摘要的插入位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审阅功能,如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request refactors the user music retrieval logic by moving the userMusicFromList function to the GameApiController and introducing a new GenericUserMusicRepo interface.

Class diagram for the new GenericUserMusicRepo hierarchy

classDiagram
    class IGenericUserMusic {
      <<interface>>
      +musicId: Int
    }

    class GenericUserMusicRepo~T~ {
      <<interface>>
      +findByUserCardExtId(extId: Long): List~T~
      +findByUser_Card_ExtIdAndMusicIdIn(userId: Long, musicId: List~Int~): List~T~
    }

    class Mai2UserMusicDetail {
      +override musicId: Int
      +level: Int
      +playCount: Int
      +achievement: Int
    }

    class UserMusicDetail {
      +override musicId: Int
      +level: Int
      +playCount: Int
      +scoreMax: Int
    }

    class WcUserScore {
      +override musicId: Int
      +level: Int
      +achievement: Int
    }

    IGenericUserMusic <|.. Mai2UserMusicDetail
    IGenericUserMusic <|.. UserMusicDetail
    IGenericUserMusic <|.. WcUserScore
    GenericUserMusicRepo <|.. Mai2UserMusicDetailRepo
    GenericUserMusicRepo <|.. Chu3UserMusicDetailRepo
    GenericUserMusicRepo <|.. WcUserBestScoreRepo

    note for IGenericUserMusic "New interface for entities with music ID"
Loading

Class diagram for GameApiController changes

classDiagram
    class GameApiController~T~ {
      +name: String
      +us: AquaUserServices
      +userDataRepo: GenericUserDataRepo~T~
      +playlogRepo: GenericPlaylogRepo~*~
      +userMusicRepo: GenericUserMusicRepo~*~
      +userMusicFromList(username: String, musicList: List~Int~)
    }

    class Maimai2 {
      +userMusicRepo: Mai2UserMusicDetailRepo
    }

    class Chusan {
      +userMusicRepo: Chu3UserMusicDetailRepo
    }

    class Wacca {
      +userMusicRepo: WcUserBestScoreRepo
    }

    class Ongeki {
      +userMusicRepo: UserMusicDetailRepository
    }

    GameApiController <|-- Maimai2
    GameApiController <|-- Chusan
    GameApiController <|-- Wacca
    GameApiController <|-- Ongeki

    note for GameApiController "Added userMusicRepo and moved userMusicFromList here"
Loading

File-Level Changes

Change Details Files
Moved userMusicFromList function to GameApiController
  • Added userMusicFromList function to GameApiController.
  • Removed userMusicFromList function from Maimai2 class.
  • Added userMusicRepo property to GameApiController.
src/main/java/icu/samnyan/aqua/net/games/GameApiController.kt
src/main/java/icu/samnyan/aqua/net/games/mai2/Maimai2.kt
Introduced GenericUserMusicRepo interface
  • Created IGenericUserMusic interface.
  • Created GenericUserMusicRepo interface extending JpaRepository.
  • Implemented GenericUserMusicRepo in Mai2UserMusicDetailRepo, Chu3UserMusicDetailRepo, WcUserBestScoreRepo, and UserMusicDetailRepository.
  • Added findByUserCardExtId and findByUser_Card_ExtIdAndMusicIdIn methods to GenericUserMusicRepo.
src/main/java/icu/samnyan/aqua/net/games/Models.kt
src/main/java/icu/samnyan/aqua/sega/maimai2/model/Repos.kt
src/main/java/icu/samnyan/aqua/sega/chusan/model/Chu3Repos.kt
src/main/java/icu/samnyan/aqua/sega/wacca/model/db/Repos.kt
src/main/java/icu/samnyan/aqua/sega/ongeki/dao/userdata/UserMusicDetailRepository.java
Implemented IGenericUserMusic interface in various user music detail classes
  • Implemented IGenericUserMusic in UserMusicDetail, Mai2UserMusicDetail, WcUserScore, and UserMusicDetail classes.
  • Added musicId property to the implementing classes if it didn't already exist.
src/main/java/icu/samnyan/aqua/sega/chusan/model/userdata/UserMusicDetail.kt
src/main/java/icu/samnyan/aqua/sega/maimai2/model/userdata/UserEntities.kt
src/main/java/icu/samnyan/aqua/sega/wacca/model/db/WaccaUserModels.kt
src/main/java/icu/samnyan/aqua/sega/ongeki/model/userdata/UserMusicDetail.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

@clansty - 我已经审查了你的更改,看起来非常棒!

以下是我在审查期间关注的内容
  • 🟢 一般性问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目是免费的 - 如果你喜欢我们的评论,请考虑分享 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用这些反馈来改进你的评论。
Original comment in English

Hey @clansty - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hykilpikonna hykilpikonna merged commit 7824ab9 into v1-dev Jan 5, 2025
@hykilpikonna hykilpikonna deleted the refactor/GenericUserMusicRepo branch January 5, 2025 12:26
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.

2 participants