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

feat(office): migrated Dbflow to Room #2309

Closed

Conversation

Nagarjuna0033
Copy link

@Nagarjuna0033 Nagarjuna0033 commented Feb 13, 2025

Fixes - Jira-#389

Didn't create a Jira ticket, click here to create new.

Please Add Screenshots If there are any UI changes.

Before After

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Comment on lines 18 to 25
fun fromOpeningDateList(list: List<Int?>?): String {
return Gson().toJson(list)
}

@TypeConverter
fun toOpeningDateList(json: String): List<Int?> {
return Gson().fromJson(json, object : TypeToken<List<Int?>>() {}.type)
}

This comment was marked as resolved.

@ColumnInfo(name = "openingDate")
var openingDate: List<Int?> = ArrayList(),
) : Parcelable
val openingDate: List<Int?> = ArrayList(),

This comment was marked as resolved.

itsPronay and others added 7 commits February 13, 2025 14:05
* [database/survey] dbflow to room

[database/survey] dbflow to room

* removed extra changes

* fixed spotless and detekt
* MIFOSAC-391 database.staff dbflow to room

* remove suspend

* made suggested changes

* fix
…igrating-office-to-room

# Conflicts:
#	core/data/src/main/java/com/mifos/core/data/repository/CreateNewClientRepository.kt
#	core/data/src/main/java/com/mifos/core/data/repositoryImp/CreateNewClientRepositoryImp.kt
#	core/database/src/main/java/com/mifos/room/db/MifosDatabase.kt
#	core/database/src/main/java/com/mifos/room/di/DaoModule.kt
#	core/database/src/main/java/com/mifos/room/entities/organisation/Staff.kt
@@ -25,9 +26,9 @@ interface CreateNewClientRepository {

fun clientTemplate(): Observable<ClientsTemplate>

suspend fun offices(): List<Office>
suspend fun offices(): List<OfficeEntity>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could be Flow

import rx.Observable

/**
* Created by Aditya Gupta on 10/08/23.
*/
interface CreateNewGroupRepository {

suspend fun offices(): List<Office>
suspend fun offices(): List<OfficeEntity>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could be Flow, and i wonder why we have same methods in multiple files

return dataManagerOffices.offices()
}

override suspend fun getStaffInOffice(officeId: Int): List<Staff> {
override fun getStaffInOffice(officeId: Int): Flow<List<Staff>> {
Copy link
Collaborator

@niyajali niyajali Feb 15, 2025

Choose a reason for hiding this comment

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

Inject ioDispatcher in this class and use flowOn(ioDispatcher) oparator, for all methods which returns as Flow, do this in other classes too

Copy link
Contributor

Choose a reason for hiding this comment

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

@niyajali I implemented your suggestions before, but @therajanmaurya bhaiya advised against using them.

@niyajali
Copy link
Collaborator

And for suspend fun use withContext(ioDispatcher) to switch the thread for all one time events like create/update etc..

@Nagarjuna0033 @itsPronay @biplab1 above these comments might helps

@biplab1
Copy link
Contributor

biplab1 commented Feb 17, 2025

And for suspend fun use withContext(ioDispatcher) to switch the thread for all one time events like create/update etc..

@Nagarjuna0033 @itsPronay @biplab1 above these comments might helps

@niyajali Thanks for the suggestion!

@therajanmaurya
Copy link
Member

Close in reference of #2314

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.

5 participants