Skip to content

teams: smoother create request view modelling (fixes #11705)#11622

Merged
dogi merged 8 commits intomasterfrom
refactor-typed-create-team-13512463426204802607
Mar 4, 2026
Merged

teams: smoother create request view modelling (fixes #11705)#11622
dogi merged 8 commits intomasterfrom
refactor-typed-create-team-13512463426204802607

Conversation

@dogi
Copy link
Member

@dogi dogi commented Mar 2, 2026

Introduced typed CreateTeamRequest to remove inline JsonObject construction from TeamViewModel.


PR created automatically by Jules for task 13512463426204802607 started by @dogi

- 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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Collaborator

@Okuro3499 Okuro3499 left a comment

Choose a reason for hiding this comment

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

  1. 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.
  2. 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.
  3. 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>
@dogi dogi requested a review from Okuro3499 March 2, 2026 20:37
@dogi dogi changed the title Refactor TeamViewModel to use typed CreateTeamRequest teams: smoother create request view modelling (fixes #11705) Mar 4, 2026
@dogi dogi merged commit a588179 into master Mar 4, 2026
3 checks passed
@Okuro3499 Okuro3499 deleted the refactor-typed-create-team-13512463426204802607 branch March 5, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants