Skip to content

Commit

Permalink
Remove unnecessary files and codes
Browse files Browse the repository at this point in the history
  • Loading branch information
HekmatullahAmin committed Jan 22, 2025
1 parent 04a2f71 commit 2d6ae1c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 195 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ actual typealias ForeignKey = ForeignKey
actual typealias Index = Index

actual typealias Entity = Entity

// actual typealias OnConflictStrategy = OnConflictStrategy
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ expect annotation class Query(
val value: String,
)

// @Suppress("NO_ACTUAL_FOR_EXPECT")
// expect annotation class OnConflictStrategy {
// companion object {
// val NONE: Int
// val REPLACE: Int
// val ROLLBACK: Int
// val ABORT: Int
// val FAIL: Int
// val IGNORE: Int
// }
// }

@Suppress("NO_ACTUAL_FOR_EXPECT")
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
Expand Down Expand Up @@ -69,3 +57,14 @@ expect annotation class Entity(
val foreignKeys: Array<ForeignKey>,
val ignoredColumns: Array<String>,
)

class OnConflictStrategy {
companion object {
const val NONE = 0
const val REPLACE = 1
const val ROLLBACK = 2
const val ABORT = 3
const val FAIL = 4
const val IGNORE = 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package org.mifos.mobile.core.database.dao
import kotlinx.coroutines.flow.Flow
import org.mifos.mobile.core.database.Dao
import org.mifos.mobile.core.database.Insert
import org.mifos.mobile.core.database.OnConflictStrategy
import org.mifos.mobile.core.database.Query
import org.mifos.mobile.core.database.entity.ChargeEntity

Expand All @@ -21,9 +22,9 @@ interface ChargeDao {
@Query("SELECT * FROM charges")
fun getAllLocalCharges(): Flow<List<ChargeEntity>>

@Insert(entity = ChargeEntity::class, onConflict = 1)
@Insert(entity = ChargeEntity::class, onConflict = OnConflictStrategy.REPLACE)
suspend fun insertCharge(charge: List<ChargeEntity>)

@Insert(entity = ChargeEntity::class, onConflict = 1)
@Insert(entity = ChargeEntity::class, onConflict = OnConflictStrategy.REPLACE)
suspend fun syncCharges(charges: List<ChargeEntity>)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package org.mifos.mobile.core.database.dao
import kotlinx.coroutines.flow.Flow
import org.mifos.mobile.core.database.Dao
import org.mifos.mobile.core.database.Insert
import org.mifos.mobile.core.database.OnConflictStrategy
import org.mifos.mobile.core.database.Query
import org.mifos.mobile.core.database.entity.MifosNotificationEntity

Expand All @@ -24,7 +25,7 @@ interface MifosNotificationDao {
@Query("SELECT COUNT(*) FROM mifos_notification WHERE read = 0")
fun getUnreadNotificationsCount(): Flow<Int>

@Insert(entity = MifosNotificationEntity::class, onConflict = 1)
@Insert(entity = MifosNotificationEntity::class, onConflict = OnConflictStrategy.REPLACE)
suspend fun saveNotification(notification: MifosNotificationEntity)

@Query("DELETE FROM mifos_notification WHERE timeStamp < :cutoffTime")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ actual typealias ForeignKey = ForeignKey
actual typealias Index = Index

actual typealias Entity = Entity

// actual typealias OnConflictStrategy = OnConflictStrategy
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ actual typealias ForeignKey = ForeignKey
actual typealias Index = Index

actual typealias Entity = Entity

// actual typealias OnConflictStrategy = OnConflictStrategy

0 comments on commit 2d6ae1c

Please sign in to comment.