Removed direct static usages of database from app

This commit is contained in:
Viktor De Pasquale
2019-05-12 15:49:42 +02:00
parent d4561507b8
commit c275326d59
16 changed files with 375 additions and 296 deletions
@@ -14,8 +14,8 @@ class SettingsDao : BaseDao() {
values(key to value.toString())
}.ignoreElement()
fun fetch(key: String) = query<Select> {
fun fetch(key: String, default: Int = -1) = query<Select> {
condition { equals("key", key) }
}.map { it.first().values.first().toIntOrNull() ?: -1 }
}.map { it.firstOrNull()?.values?.firstOrNull()?.toIntOrNull() ?: default }
}