Skip to content

Dev schoolconfing#180

Open
Anugraha-sutara wants to merge 12 commits into
mainfrom
dev-schoolconfig
Open

Dev schoolconfing#180
Anugraha-sutara wants to merge 12 commits into
mainfrom
dev-schoolconfig

Conversation

@Anugraha-sutara

Copy link
Copy Markdown
Collaborator

Implement: SchoolConfigSettingDataSource for db, http, and repository

@Anugraha-sutara Anugraha-sutara linked an issue Mar 23, 2026 that may be closed by this pull request
interface SchoolConfigSettingEntityDao {

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(entity: SchoolConfigSettingEntity)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this and the insertlist function?

}
}

override fun listAsPagingSource(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we need the paging source. We are never using the school configuration to show a long list that the user scrolls through. Please remove listAsPagingSource.

@mikedawson mikedawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello @Anugraha-sutara - this looks quite good to me. The permission checks look right. The migration also looks good.

One important improvement request: the DAO has queries for both multiple keys and a single key function. This seems like duplication to me.

I think the datasource needs to support multiple keys in a single query: e.g. for shared school device management, the screen needs to get both the setting for the PIN and the setting for whether or not user self-selection is enabled. This should not require two http requests.

Please update the datasource list params so that it can include a list of keys. This would work whether a viewmodel needs one key or more than one.

then please remove Dao functions that are no longer needed. Thanks.

@mikedawson mikedawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please put the test for school config here in the school config branch such that it can be merged.

return GetListParams(
common = GetListCommonParams.fromParams(params)
common = GetListCommonParams.fromParams(params),
keys = params.getAll(DataLayerParams.KEYS) ?: params[DataLayerParams.KEY]?.let { listOf(it) }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for "key" on it's own. Please test to ensure that conversion to/from parameters works as expected.

If it works as-is, it's OK.

There is no need for a special case for list size = 1.

@mikedawson mikedawson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The current test does not really test the repository or client server communication (as per the reference cited). Please update it to ensure it actually uses the repository, not using updateLocal as a 'cheat'.

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.

School Config Settings Datasource

2 participants