forked from openMF/android-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: realm implementation to get client list
- Loading branch information
1 parent
4822876
commit 9a05f5a
Showing
30 changed files
with
569 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 2 additions & 14 deletions
16
core/data/src/main/java/com/mifos/core/data/model/client/ClientDate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
package com.mifos.core.data.model.client | ||
|
||
import android.os.Parcelable | ||
import com.mifos.core.data.model.database.MifosBaseModel | ||
import com.mifos.core.data.model.database.MifosDatabase | ||
import com.raizlabs.android.dbflow.annotation.Column | ||
import com.raizlabs.android.dbflow.annotation.ModelContainer | ||
import com.raizlabs.android.dbflow.annotation.PrimaryKey | ||
import com.raizlabs.android.dbflow.annotation.Table | ||
import kotlinx.parcelize.Parcelize | ||
|
||
/** | ||
* Created by Rajan Maurya on 04/07/16. | ||
*/ | ||
@Parcelize | ||
@Table(database = MifosDatabase::class) | ||
@ModelContainer | ||
data class ClientDate( | ||
@PrimaryKey | ||
|
||
var clientId: Long = 0, | ||
|
||
@PrimaryKey | ||
var chargeId: Long = 0, | ||
|
||
@Column | ||
var day: Int = 0, | ||
|
||
@Column | ||
var month: Int = 0, | ||
|
||
@Column | ||
var year: Int = 0 | ||
) : MifosBaseModel(), Parcelable | ||
) : Parcelable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 2 additions & 14 deletions
16
core/data/src/main/java/com/mifos/core/data/model/client/GroupDate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
package com.mifos.core.data.model.client | ||
|
||
import android.os.Parcelable | ||
import com.mifos.core.data.model.database.MifosBaseModel | ||
import com.mifos.core.data.model.database.MifosDatabase | ||
import com.raizlabs.android.dbflow.annotation.Column | ||
import com.raizlabs.android.dbflow.annotation.ModelContainer | ||
import com.raizlabs.android.dbflow.annotation.PrimaryKey | ||
import com.raizlabs.android.dbflow.annotation.Table | ||
import kotlinx.parcelize.Parcelize | ||
|
||
/** | ||
* Created by Rajan Maurya on 18/09/16. | ||
*/ | ||
@Parcelize | ||
@Table(database = MifosDatabase::class) | ||
@ModelContainer | ||
data class GroupDate( | ||
@PrimaryKey | ||
|
||
var groupId: Long = 0, | ||
|
||
@PrimaryKey | ||
var chargeId: Long = 0, | ||
|
||
@Column | ||
var day: Int = 0, | ||
|
||
@Column | ||
var month: Int = 0, | ||
|
||
@Column | ||
var year: Int = 0 | ||
) : MifosBaseModel(), Parcelable | ||
) : Parcelable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
core/data/src/main/java/com/mifos/core/data/model/database/MifosBaseModel.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
core/data/src/main/java/com/mifos/core/data/model/database/MifosDatabase.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
core/datastore/src/main/java/com/mifos/core/database/DatabaseClientQuery.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.mifos.core.database | ||
|
||
import com.mifos.core.common.utils.Page | ||
import com.mifos.core.model.ClientDb | ||
import io.realm.kotlin.Realm | ||
import io.realm.kotlin.ext.query | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
import javax.inject.Inject | ||
|
||
class DatabaseClientQuery @Inject constructor(private val realm: Realm) { | ||
|
||
fun getClientListFromDb(): Flow<Page<ClientDb>> { | ||
return realm.query<ClientDb>().asFlow() | ||
.map { Page(totalFilteredRecords = it.list.size, pageItems = it.list) } | ||
} | ||
|
||
} |
Oops, something went wrong.