Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*
* See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
*/
@file:Suppress("KotlinNoActualForExpect")

package template.core.base.database

import kotlin.reflect.KClass
Expand All @@ -29,7 +27,8 @@ import kotlin.reflect.KClass
* }
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
expect annotation class Dao()

/**
Expand All @@ -47,7 +46,8 @@ expect annotation class Dao()
* suspend fun getUsersOlderThan(minAge: Int): List<User>
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER)
@Retention(AnnotationRetention.BINARY)
expect annotation class Query(
Expand All @@ -72,7 +72,8 @@ expect annotation class Query(
* suspend fun insertUsers(users: List<User>): List<Long>
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Insert(
Expand All @@ -98,7 +99,8 @@ expect annotation class Insert(
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class PrimaryKey(
Expand All @@ -119,7 +121,9 @@ expect annotation class PrimaryKey(
* entity = User::class,
* parentColumns = ["id"],
* childColumns = ["userId"],
* onDelete = ForeignKey.CASCADE
* onDelete = ForeignKeyAction.CASCADE,
* onUpdate = ForeignKeyAction.CASCADE,
* deferred = false
* )]
* )
* data class Post(
Expand All @@ -129,10 +133,16 @@ expect annotation class PrimaryKey(
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@Target(allowedTargets = [])
@Retention(AnnotationRetention.BINARY)
expect annotation class ForeignKey
expect annotation class ForeignKey(
val entity: KClass<*>,
val parentColumns: Array<String>,
val childColumns: Array<String>,
val onDelete: Int,
val onUpdate: Int,
val deferred: Boolean,
)

/**
* Cross-platform annotation for defining database indexes.
Expand All @@ -157,7 +167,6 @@ expect annotation class ForeignKey
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@Target(allowedTargets = [])
@Retention(AnnotationRetention.BINARY)
expect annotation class Index
Expand Down Expand Up @@ -190,7 +199,8 @@ expect annotation class Index
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
expect annotation class Entity(
Expand Down Expand Up @@ -221,7 +231,8 @@ expect annotation class Entity(
* suspend fun updateUsers(users: List<User>): Int
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Update(
Expand All @@ -247,7 +258,8 @@ expect annotation class Update(
* suspend fun deleteUsers(users: List<User>): Int
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Delete(
Expand All @@ -272,7 +284,8 @@ expect annotation class Delete(
* suspend fun upsertUsers(users: List<User>): List<Long>
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Upsert(
Expand Down Expand Up @@ -300,7 +313,8 @@ expect annotation class Upsert(
* suspend fun getUserWithPosts(userId: Long): UserWithPosts
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Transaction()
Expand Down Expand Up @@ -331,7 +345,8 @@ expect annotation class Transaction()
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class ColumnInfo(
Expand Down Expand Up @@ -371,7 +386,8 @@ expect annotation class ColumnInfo(
* // This creates columns: id, name, home_street, home_city, home_zipCode, work_street, work_city, work_zipCode
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Embedded(
Expand Down Expand Up @@ -410,7 +426,8 @@ expect annotation class Embedded(
* }
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FIELD, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class Relation(
Expand Down Expand Up @@ -454,7 +471,6 @@ expect annotation class Relation(
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@Target(allowedTargets = [])
@Retention(AnnotationRetention.BINARY)
expect annotation class Junction(
Expand Down Expand Up @@ -490,7 +506,8 @@ expect annotation class Junction(
* abstract class MyDatabase : RoomDatabase()
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
expect annotation class TypeConverter()
Expand Down Expand Up @@ -524,7 +541,8 @@ expect annotation class TypeConverter()
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(
AnnotationTarget.FUNCTION,
AnnotationTarget.CLASS,
Expand Down Expand Up @@ -564,7 +582,7 @@ expect annotation class TypeConverters(
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")

@Target(allowedTargets = [])
@Retention(AnnotationRetention.BINARY)
expect annotation class BuiltInTypeConverters()
Expand Down Expand Up @@ -596,7 +614,8 @@ expect annotation class BuiltInTypeConverters()
* }
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
expect annotation class Database(
Expand Down Expand Up @@ -630,7 +649,6 @@ expect annotation class Database(
* abstract class AppDatabase : RoomDatabase()
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@Target(allowedTargets = [])
@Retention(AnnotationRetention.BINARY)
expect annotation class AutoMigration(
Expand Down Expand Up @@ -667,7 +685,8 @@ expect annotation class AutoMigration(
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(
AnnotationTarget.FIELD,
AnnotationTarget.CONSTRUCTOR,
Expand Down Expand Up @@ -700,7 +719,8 @@ expect annotation class Ignore()
* )
* ```
*/
@Suppress("NO_ACTUAL_FOR_EXPECT")
@OptIn(ExperimentalMultiplatform::class)
@OptionalExpectation
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
expect annotation class DatabaseView(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package template.core.base.database

import kotlin.reflect.KClass

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class BuiltInTypeConverters actual constructor()

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class AutoMigration actual constructor(
actual val from: Int,
actual val to: Int,
actual val spec: KClass<*>,
)

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class Junction actual constructor(
actual val value: KClass<*>,
actual val parentColumn: String,
actual val entityColumn: String,
)

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class Index

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class ForeignKey actual constructor(
actual val entity: KClass<*>,
actual val parentColumns: Array<String>,
actual val childColumns: Array<String>,
actual val onDelete: Int,
actual val onUpdate: Int,
actual val deferred: Boolean,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package template.core.base.database

import kotlin.reflect.KClass

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class BuiltInTypeConverters actual constructor()

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class AutoMigration actual constructor(
actual val from: Int,
actual val to: Int,
actual val spec: KClass<*>,
)

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class Junction actual constructor(
actual val value: KClass<*>,
actual val parentColumn: String,
actual val entityColumn: String,
)

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class Index

@Target(allowedTargets = [])
@Retention(value = AnnotationRetention.BINARY)
actual annotation class ForeignKey actual constructor(
actual val entity: KClass<*>,
actual val parentColumns: Array<String>,
actual val childColumns: Array<String>,
actual val onDelete: Int,
actual val onUpdate: Int,
actual val deferred: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@
package org.mifos.core.database

import org.mifos.core.database.dao.SampleDao
import org.mifos.core.database.utils.ChargeTypeConverters
import template.core.base.database.BuiltInTypeConverters
import template.core.base.database.TypeConverters

@Suppress("NO_ACTUAL_FOR_EXPECT")
@TypeConverters(
ChargeTypeConverters::class,
builtInTypeConverters = BuiltInTypeConverters(),
)
expect abstract class AppDatabase {
abstract val sampleDao: SampleDao
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ val DatabaseModule = module {
single { get<AppDatabase>().sampleDao }
}

@Suppress("NO_ACTUAL_FOR_EXPECT")
expect val platformModule: Module
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate word in license comment.

See See should be See.

✏️ Proposed fix
- * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
+ * See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
* See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/database/src/jsMain/kotlin/org/mifos/core/database/di/DatabaseModule.js.kt`
at line 8, Fix the duplicated word in the top-of-file license comment in
DatabaseModule.js.kt: replace the "See See" occurrence with a single "See" in
the license header comment (the comment near the file header/license block) to
correct the typo while preserving the rest of the license text and formatting.

*/
package org.mifos.core.database.di

import org.koin.dsl.module

actual val platformModule = module {
// EMPTY — no DB on Js
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2026 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same duplicate-word typo in license comment as in the JS counterpart.

See SeeSee.

✏️ Proposed fix
- * See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
+ * See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* See See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
* See https://github.com/openMF/kmp-project-template/blob/main/LICENSE
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/database/src/wasmJsMain/kotlin/org/mifos/core/database/di/DatabaseModule.wasmJs.kt`
at line 8, The license header in DatabaseModule.wasmJs.kt contains a duplicated
word "See See"; update the top-of-file comment to read "See" (replace "See See"
with "See") so the license line matches the JS counterpart and corrects the
typo.

*/
package org.mifos.core.database.di

import org.koin.dsl.module

actual val platformModule = module {
// EMPTY — no DB on WasmJs
}
Loading