Skip to content

Fix Room implementation and Koin DatabaseModule integration#127

Merged
niyajali merged 1 commit intoopenMF:devfrom
Arinyadav1:Fix-Room-And-DatabaseModule-impl
Feb 24, 2026
Merged

Fix Room implementation and Koin DatabaseModule integration#127
niyajali merged 1 commit intoopenMF:devfrom
Arinyadav1:Fix-Room-And-DatabaseModule-impl

Conversation

@Arinyadav1
Copy link
Contributor

@Arinyadav1 Arinyadav1 commented Feb 23, 2026

Fixes - Jira-#KMPPT-92

I added these files because declaration annotated with @OptionalExpectation can only be used inside an annotation entry.

Marks an @OptionalExpectation annotation class that it isn't required to have actual counterparts in all platforms.

core-base/database/src/jsMain/kotlin/template/core/base/database/Room.js.kt
core-base/database/src/wasmJsMain/kotlin/template/core/base/database/Room.wasmJs.kt

image image image

Summary by CodeRabbit

  • New Features

    • Expanded database annotation parameters for richer configuration capabilities.
    • Added platform-specific support for JavaScript and WebAssembly targets.
  • Refactor

    • Removed unnecessary code suppressions and cleaned up configuration declarations.

@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

The PR expands Room annotation signatures across the multiplatform database layer by adding new parameters to annotations (Query, Insert, PrimaryKey, ForeignKey, ColumnInfo, Embedded, Relation, Junction), introduces platform-specific annotation implementations for JS and WasmJS targets, removes TypeConverters configuration from the core database, and eliminates NO_ACTUAL_FOR_EXPECT suppressions while adding OptionalExpectation metadata.

Changes

Cohort / File(s) Summary
Room Annotation Signature Expansion
core-base/database/src/commonMain/kotlin/template/core/base/database/Room.kt
Expanded public signatures for Query (added value: String), Insert (added entity, onConflict), PrimaryKey (added autoGenerate), ForeignKey (added entity, parentColumns, childColumns, onDelete, onUpdate, deferred), ColumnInfo (added name, typeAffinity, index, collate, defaultValue), Embedded (added prefix), Relation (added entity, parentColumn, entityColumn, associateBy, projection), and Junction (added value, parentColumn, entityColumn). Applied OptionalExpectation metadata and removed suppressions.
Platform-Specific Annotation Implementations
core-base/database/src/jsMain/kotlin/.../Room.js.kt, core-base/database/src/wasmJsMain/kotlin/.../Room.wasmJs.kt
Added platform-specific actual annotation implementations (BuiltInTypeConverters, AutoMigration, Junction, Index, ForeignKey) for JS and WasmJS targets with matching signatures and @Target/@retention metadata.
Database Configuration Cleanup
core/database/src/commonMain/kotlin/org/mifos/core/database/AppDatabase.kt
Removed TypeConverters annotation block and related imports (ChargeTypeConverters, BuiltInTypeConverters) from AppDatabase declaration.
Suppression Removal
core/database/src/commonMain/kotlin/org/mifos/core/database/di/DatabaseModule.kt
Removed @Suppress("NO_ACTUAL_FOR_EXPECT") annotation from expect platformModule declaration.
Platform-Specific DI Modules
core/database/src/jsMain/kotlin/org/mifos/core/database/di/DatabaseModule.js.kt, core/database/src/wasmJsMain/kotlin/org/mifos/core/database/di/DatabaseModule.wasmJs.kt
Added platform implementations for actual platformModule using empty Koin modules with comments indicating no database support on JS and WasmJS targets.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #109: Modifies the Room multiplatform annotation surface (Query, Insert, PrimaryKey, ForeignKey, ColumnInfo, Embedded, Relation, Junction expect/actual mappings).
  • #110: Expands Room annotation API including BuiltInTypeConverters and other Room-related annotations/metadata.
  • #112: Modifies Room annotation declarations and AppDatabase/type-converter configuration in the same files.

Poem

🐰 A rabbit hops through Room's new door,
With ForeignKeys and columns galore,
Annotations expanded, platforms aligned,
JS and Wasm left clean and refined,
The database thrives in multiplatform cheer! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: fixing Room implementation and Koin DatabaseModule integration across multiple platform-specific files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Arinyadav1 Arinyadav1 force-pushed the Fix-Room-And-DatabaseModule-impl branch from 3923d0f to a1fa422 Compare February 23, 2026 20:57
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
core/database/src/wasmJsMain/kotlin/org/mifos/core/database/di/DatabaseModule.wasmJs.kt (1)

14-16: Same missing explicit type annotation as the JS counterpart.

🤖 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`
around lines 14 - 16, The actual declaration platformModule in
DatabaseModule.wasmJs.kt lacks the explicit type annotation present in the JS
counterpart; update the declaration for platformModule to include the explicit
Koin Module type (e.g., ": Module" or the fully qualified type) so it matches
the expected signature used elsewhere (ensure any necessary import for Module is
added) and keep the body as-is (module { /* EMPTY — no DB on WasmJs */ }).
🧹 Nitpick comments (1)
core/database/src/jsMain/kotlin/org/mifos/core/database/di/DatabaseModule.js.kt (1)

14-16: Add explicit type annotation to actual val platformModule for consistency.

The expect declaration in commonMain explicitly specifies Module as the type. Most platform implementations (android, desktop, native) include this type annotation, but jsMain is missing it. Adding it improves clarity and maintains consistency across all platform targets.

♻️ Proposed refactor
-actual val platformModule = module {
+actual val platformModule: Module = module {

Ensure the import is present:

import org.koin.core.module.Module
🤖 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`
around lines 14 - 16, The JS implementation of the expected declaration is
missing an explicit type: change the declaration of actual val platformModule to
include the Module type (i.e., actual val platformModule: Module = module { /*
EMPTY — no DB on Js */ }) and ensure the file imports
org.koin.core.module.Module so the type resolves; update the declaration for the
symbol platformModule in DatabaseModule.js.kt accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/database/src/jsMain/kotlin/org/mifos/core/database/di/DatabaseModule.js.kt`:
- 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.

In
`@core/database/src/wasmJsMain/kotlin/org/mifos/core/database/di/DatabaseModule.wasmJs.kt`:
- 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.

---

Duplicate comments:
In
`@core/database/src/wasmJsMain/kotlin/org/mifos/core/database/di/DatabaseModule.wasmJs.kt`:
- Around line 14-16: The actual declaration platformModule in
DatabaseModule.wasmJs.kt lacks the explicit type annotation present in the JS
counterpart; update the declaration for platformModule to include the explicit
Koin Module type (e.g., ": Module" or the fully qualified type) so it matches
the expected signature used elsewhere (ensure any necessary import for Module is
added) and keep the body as-is (module { /* EMPTY — no DB on WasmJs */ }).

---

Nitpick comments:
In
`@core/database/src/jsMain/kotlin/org/mifos/core/database/di/DatabaseModule.js.kt`:
- Around line 14-16: The JS implementation of the expected declaration is
missing an explicit type: change the declaration of actual val platformModule to
include the Module type (i.e., actual val platformModule: Module = module { /*
EMPTY — no DB on Js */ }) and ensure the file imports
org.koin.core.module.Module so the type resolves; update the declaration for the
symbol platformModule in DatabaseModule.js.kt accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 619304b and a1fa422.

📒 Files selected for processing (7)
  • core-base/database/src/commonMain/kotlin/template/core/base/database/Room.kt
  • core-base/database/src/jsMain/kotlin/template/core/base/database/Room.js.kt
  • core-base/database/src/wasmJsMain/kotlin/template/core/base/database/Room.wasmJs.kt
  • core/database/src/commonMain/kotlin/org/mifos/core/database/AppDatabase.kt
  • core/database/src/commonMain/kotlin/org/mifos/core/database/di/DatabaseModule.kt
  • core/database/src/jsMain/kotlin/org/mifos/core/database/di/DatabaseModule.js.kt
  • core/database/src/wasmJsMain/kotlin/org/mifos/core/database/di/DatabaseModule.wasmJs.kt
💤 Files with no reviewable changes (2)
  • core/database/src/commonMain/kotlin/org/mifos/core/database/AppDatabase.kt
  • core/database/src/commonMain/kotlin/org/mifos/core/database/di/DatabaseModule.kt

* 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

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.

* 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

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.

@Arinyadav1
Copy link
Contributor Author

Arinyadav1 commented Feb 24, 2026

@niyajali please review and merge it

@niyajali niyajali enabled auto-merge (squash) February 24, 2026 15:20
@niyajali niyajali merged commit c4a85c9 into openMF:dev Feb 24, 2026
8 checks passed
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.

2 participants