teams: smoother create request view modelling (fixes #11705)#11622
teams: smoother create request view modelling (fixes #11705)#11622
Conversation
- Introduced `CreateTeamRequest` data class in `TeamsRepository`. - Added `createTeamAndAddMember(CreateTeamRequest)` to abstract the JSON creation away from the presentation layer. - Refactored `TeamViewModel.createTeam` to stop building `JsonObject` and utilize `CreateTeamRequest` instead. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Okuro3499
left a comment
There was a problem hiding this comment.
- Old overload not removed — interface bloat. The JsonObject overload remains in both TeamsRepository and TeamsRepositoryImpl. TeamViewModel is the only caller and it has been migrated. The old overload is now dead weight that advertises a raw-JSON API that shouldn't be used. Either remove it and inline the JsonObject-building into the impl's single method body, or keep only one public signature. Having two createTeamAndAddMember overloads in the interface is confusing to future contributors.
- Fully-qualified class name in TeamViewModel. TeamViewModel.kt:134 uses org.ole.planet.myplanet.repository.CreateTeamRequest(...) instead of importing it. The file already imports org.ole.planet.myplanet.repository.TeamsRepository — adding a second import for CreateTeamRequest is the standard fix. This is a code smell that implies the import was missed and the build was checked by FQN as a workaround.
- CreateTeamRequest is in the wrong package. It lives in repository/ but it is a ViewModel input DTO with no persistence or network concerns. By the project's own layered architecture (UI → Repository → Service → Data), this type belongs either in ui/teams/ (nearest consumer) or a dedicated model/ DTO. Placing it in the repository package makes the repository layer aware of a ViewModel-shaped concern.
- Move `CreateTeamRequest` to `org.ole.planet.myplanet.model` and import it instead of using FQN in `TeamViewModel.kt`. - Remove the old `createTeamAndAddMember(JsonObject)` overload entirely from `TeamsRepository` and `TeamsRepositoryImpl` to clean up interface bloat. - Instantiate `CreateTeamRequest` and pass it to `createTeamAndAddMember` which performs mapping internally. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Introduced typed
CreateTeamRequestto remove inlineJsonObjectconstruction fromTeamViewModel.PR created automatically by Jules for task 13512463426204802607 started by @dogi