A new DAO class ArtistsByEntityDao has been added to manage database operations for the Artists_by_entity table, including insertions, deletions, and queries with support for coroutines and paging.
Sweep Found These Issues
The getNumberOfArtistsByEntity method uses a hardcoded query string "%%" which may not be necessary and could lead to unexpected results.
The insertAll method does not handle potential exceptions that could occur during the transaction, which might leave the database in an inconsistent state.
Introduced a new table artists_by_entity and associated SQL operations for inserting, deleting, counting, and retrieving artists by entity.
Sweep Found These Issues
The deleteArtistsByEntity query incorrectly references the artist table instead of artists_by_entity for deletion, which could lead to unintended data loss.
The changes generalize the method for browsing artists to support various entity types by introducing a new parameter for the entity type and updating the request URL construction accordingly.
Sweep Found These Issues
The change from collectionId to entityId and the addition of entity requires careful handling to ensure that the correct resourceUri is used for different entity types, which could introduce bugs if not properly managed.
Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
The dynamic construction of the request URL using entity.resourceUri could fail if resourceUri is not correctly defined for all possible MusicBrainzEntity values.
The changes introduce the ArtistsByEntityDao to handle database operations for artists by entity, expanding the functionality of several methods to support more entity types without raising errors.
Sweep Found These Issues
The deleteLinkedEntitiesByEntity method now deletes artists for all entity types without checking if the entity type is valid, which could lead to unintended deletions.
The getLinkedEntitiesPagingSource method now retrieves artists for all entity types without checking if the entity type is valid, which could lead to incorrect data retrieval.
The insertAllLinkingModels method now inserts artist-entity links for all entity types without checking if the entity type is valid, which could lead to incorrect data insertion.
The changes introduce functionality to handle artist-related data within the AreaPresenter by adding new dependencies, initializing UI state, handling events, and updating the overall state management.
Potential Issues
Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
The new artistsByEntityPresenter dependency is not checked for nullability, which could lead to a NullPointerException if it is not properly initialized.
The changes introduce functionality to collect and include artist statistics in the StatsUiState by adding a new DAO dependency and state variables for remote and local artist counts.
Two new properties, artists and cachedArtists, were added to the AppStrings data class to enhance string resource management and formatting capabilities.
The method browseArtistsByCollection was renamed to browseArtistsByEntity, with the parameter collectionId replaced by entityId and a new parameter entity added.
Sweep: PR Review
data/database/src/commonMain/kotlin/ly/david/musicsearch/data/database/DatabaseDaoModule.kt
The changes add
ArtistsByEntityDao
to the import statements and the dependency injection module, ensuring it can be used throughout the application.data/database/src/commonMain/kotlin/ly/david/musicsearch/data/database/dao/ArtistsByEntityDao.kt
A new DAO class
ArtistsByEntityDao
has been added to manage database operations for theArtists_by_entity
table, including insertions, deletions, and queries with support for coroutines and paging.Sweep Found These Issues
getNumberOfArtistsByEntity
method uses a hardcoded query string "%%" which may not be necessary and could lead to unexpected results.insertAll
method does not handle potential exceptions that could occur during the transaction, which might leave the database in an inconsistent state.data/database/src/commonMain/sqldelight/ly.david.musicsearch.data.database/artists_by_entity.sq
Introduced a new table
artists_by_entity
and associated SQL operations for inserting, deleting, counting, and retrieving artists by entity.Sweep Found These Issues
deleteArtistsByEntity
query incorrectly references theartist
table instead ofartists_by_entity
for deletion, which could lead to unintended data loss.data/database/src/commonMain/sqldelight/migrations/5.sqm
A new table
artists_by_entity
is created withentity_id
andartist_id
as non-null columns and a composite primary key.data/musicbrainz/src/commonMain/kotlin/ly/david/musicsearch/data/musicbrainz/api/BrowseApi.kt
The changes generalize the method for browsing artists to support various entity types by introducing a new parameter for the entity type and updating the request URL construction accordingly.
Sweep Found These Issues
collectionId
toentityId
and the addition ofentity
requires careful handling to ensure that the correctresourceUri
is used for different entity types, which could introduce bugs if not properly managed.Potential Issues
Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
entity.resourceUri
could fail ifresourceUri
is not correctly defined for all possibleMusicBrainzEntity
values.data/repository/src/commonMain/kotlin/ly/david/musicsearch/data/repository/artist/ArtistsByEntityRepositoryImpl.kt
The changes introduce the
ArtistsByEntityDao
to handle database operations for artists by entity, expanding the functionality of several methods to support more entity types without raising errors.Sweep Found These Issues
deleteLinkedEntitiesByEntity
method now deletes artists for all entity types without checking if the entity type is valid, which could lead to unintended deletions.getLinkedEntitiesPagingSource
method now retrieves artists for all entity types without checking if the entity type is valid, which could lead to incorrect data retrieval.insertAllLinkingModels
method now inserts artist-entity links for all entity types without checking if the entity type is valid, which could lead to incorrect data insertion.docs/all_features.md
The change updates the documentation to reflect that users can now browse artists when viewing the details of an area.
shared/feature/details/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/details/DetailsFeatureModule.kt
Added a new dependency
artistsByEntityPresenter
to theAreaPresenter
in thedetailsFeatureModule
.shared/feature/details/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/details/area/AreaPresenter.kt
The changes introduce functionality to handle artist-related data within the
AreaPresenter
by adding new dependencies, initializing UI state, handling events, and updating the overall state management.Potential Issues
Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
artistsByEntityPresenter
dependency is not checked for nullability, which could lead to aNullPointerException
if it is not properly initialized.shared/feature/details/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/details/area/AreaTab.kt
A new enum constant
ARTISTS
has been added to theAreaTab
enum class.shared/feature/details/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/details/area/AreaUi.kt
The changes introduce a new tab for displaying a list of artists associated with an area, using the
ArtistsListScreen
composable.Potential Issues
Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
lazyListState
for theArtistsListScreen
is set toeventsLazyListState
, which may cause issues as it should likely have its own distinct state.shared/feature/details/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/details/area/AreaUiState.kt
The changes include adding an import statement for
ArtistsByEntityUiState
and reordering the properties within theAreaUiState
data class.shared/feature/stats/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/stats/AreaStatsPresenter.kt
The changes introduce functionality to collect and include artist statistics in the
StatsUiState
by adding a new DAO dependency and state variables for remote and local artist counts.shared/feature/stats/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/stats/Stats.kt
A new
ArtistStats
data class has been added and integrated into theStats
data class to include artist-related statistics.shared/feature/stats/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/stats/StatsFeatureModule.kt
A new dependency
artistsByEntityDao
was added to theAreaStatsPresenter
in thestatsFeatureModule
.shared/feature/stats/src/commonMain/kotlin/ly/david/musicsearch/shared/feature/stats/StatsUi.kt
A new case for
Tab.ARTISTS
has been added to display artist statistics in theStatsUi
function.strings/src/commonMain/kotlin/ly/david/musicsearch/strings/AppStrings.kt
Two new properties,
artists
andcachedArtists
, were added to theAppStrings
data class to enhance string resource management and formatting capabilities.strings/src/commonMain/kotlin/ly/david/musicsearch/strings/EnStrings.kt
The changes introduce new localized strings for "Artists" and a template for displaying cached artists information.
test-data/src/commonMain/kotlin/ly/david/data/test/api/FakeMusicBrainzApi.kt
The method
browseArtistsByCollection
was renamed tobrowseArtistsByEntity
, with the parametercollectionId
replaced byentityId
and a new parameterentity
added.ui/common/src/commonMain/kotlin/ly/david/ui/common/topappbar/Tab.kt
The changes introduce a new
ARTISTS
value to theTab
enum and update thegetTitle
function to return the appropriate title for this new tab.