-
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.
This diff introduces several improvements to the Kotlin code, primari…
…ly focused on SQL query handling and test cleanup. Let's break down the changes: **1. Removal of Redundant Test Code:** The deleted lines in `ServiceTests.kt` suggest a redundant test case for signup functionality. The removed code was likely a duplicate of the existing parameterized test, which already covers the same scenario. This simplification reduces code duplication and improves maintainability. **2. Consistent use of `trimIndent`:** The most significant change is the consistent application of `.trimIndent()` to SQL queries across `UserActivationDao.kt`, `UserDao.kt`. `trimIndent()` removes leading whitespace from each line of a multiline string, making the SQL queries cleaner, more readable, and less prone to errors caused by unexpected whitespace. This also improves the presentation of the queries in logs and debugging output. Crucially, this prevents SQL syntax errors when previously leading whitespace may have been unintentionally included in the executed query string. **3. Improved SQL Query Formatting in `UserDao.kt`:** The `INSERT` statement in `UserDao.kt` has been reformatted for better readability. While functionally equivalent to the previous version, the new formatting aligns the values with their corresponding fields, enhancing clarity. **4. `UserActivationDao.kt` - Updating Activation Status:** A new SQL query `UPDATE_ACTIVATION_BY_KEY` has been added to `UserActivationDao.kt`. This query allows updating the activation status and timestamp directly in the database when a user activates their account. This likely replaces a less efficient approach, potentially involving retrieving the activation record, modifying it, and then saving it back. This change streamlines the activation process. **5. Summary:** These changes collectively improve the code's readability, maintainability, and efficiency. The consistent use of `trimIndent()` is a significant improvement, minimizing the risk of SQL errors due to whitespace, and improving the readability of SQL queries within the code. The addition of `UPDATE_ACTIVATION_BY_KEY` optimizes the user activation workflow. Removing the redundant test code streamlines the test suite.
- Loading branch information
Showing
3 changed files
with
31 additions
and
19 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
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