-
-
Notifications
You must be signed in to change notification settings - Fork 0
Update to ServiceIO v3 #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
NonSwag
wants to merge
35
commits into
main
Choose a base branch
from
service-io/v3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or 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
Replaced `ServiceBankController` and `ServiceEconomyController` with `BankControllerDelegate` and `EconomyControllerDelegate` for improved modularity and currency support.
Improved handling of `Currency` in account management, balance calculations, and command messages. Replaced redundant methods in `EconomistEconomyController` and adjusted SQL queries to respect currency.
Introduced `setupDatabase` method to centralize table creation for accounts, banks, and triggers. Removed redundant account-deleting methods in favor of a streamlined `prune` implementation. Updated commands to leverage `prune` for improved efficiency and simplicity.
Included SQLite database migration to `v1`, added `balances` table, and improved schema for `accounts`, `banks`, and `currencies`. Refactored `EconomistAccount` and `EconomistBank` for better balance handling and consistency. Updated commands, listeners, and controllers to align with new schema and logic.
Updated `balances` field to use `Currency` as key, replaced `getBalances` return type with unmodifiable map, and adjusted balance retrieval logic for consistency. Added Javadoc to clarify behavior of `getBalances`.
Introduced `markDirty` and `saveDirty` methods in controllers to optimize saving only modified accounts and banks. Updated `EconomistAccount` and `EconomistBank` to track changes automatically.
Introduced `getAccountsUpdatedSince` for incremental database sync, synchronized accounts at regular intervals, and enhanced account caching logic. Updated configurations for auto-saving and synchronization intervals. Added supporting SQL query and refactored relevant controllers.
Replaced the `MySQL` entry in `StorageType` enumeration with `MariaDB` to reflect the supported database options.
Eliminated the unused `MongoDB` option in the `StorageType` enumeration to reflect the supported storage solutions.
Introduced `PostgreSQLController` as a new `DataController` option. Updated configuration handling to include PostgreSQL in `storageType`. Preparation for future PostgreSQL implementation.
Introduced a reminder to enhance the query by supporting filtering by currency and optionally by world.
Reordered fields to align with conventions and added `@Nullable` annotation for batch parameters in `executeBatchUpdate`. Adjusted spacing and cleaned up unused lines.
Replaced `Optional`-based lookup with streamlined `stream().anyMatch` for better readability and performance.
Ensured the default currency is added to the list during initialization. Added a TODO comment to handle deletion of the default currency properly.
Removed `mavenLocal` from repositories to clean up build configuration and updated `service-io` version to the latest pre-release. This ensures compatibility with new features and fixes.
Introduced methods to verify deposit and withdrawal capabilities based on currency compatibility. Enhanced balance manipulation logic for better validation using `canHold`.
Included the `https://repo.thenextlvl.net/snapshots` repository in `build.gradle.kts` to enable dependency resolution for snapshot versions.
Reintroduced the accidentally removed method that retrieves all balances as an unmodifiable map. Updated its documentation for clarity.
Implemented methods to verify if accounts and banks can handle specific currencies and transactions. These changes improve validation and ensure compliance in balance operations.
Configured `tasks.javadoc` to include custom tags (`apiNote`, `implSpec`) and made `test` depend on `javadoc`. Improvements ensure better API documentation generation.
Relocated `tasks.javadoc` and its dependencies to `api/build.gradle.kts` for better separation of build logic between core and API modules.
Moved task scheduling logic to a public `scheduleTasks` method in `EconomistEconomyController`. This ensures tasks are explicitly initiated during the plugin's `onEnable` phase.
Added a check in `deleteCurrency` to ensure the default currency cannot be deleted. Updated Javadocs to reflect this behavior.
Cleaned up redundant comment referencing outdated functionality.
Specified mutability and purity contracts for better static analysis and code documentation.
Refactored `SQLiteController` for enhanced batch operations and added support for multiple SQL statements. Introduced currency-specific arguments in commands and updated database schema to handle multiple currencies.
Refactored commands to include `currency` as an argument, enabling multi-currency handling in balance operations. Default currency is used when none is specified.
The `id` column now acts as a regular foreign key referencing the `accounts` table. This change allows more flexible relationships and adheres to updated schema requirements.
Introduced a query to reset the `last_update` field in the `accounts` table for specified `uuid` and `world`, enhancing data consistency.
Simplified SQL by removing unused WITH clause and `accounts` update logic. Enhanced readability and maintained functionality with optimized subquery.
Updated the catch block in `pullChangesFromDatabase` to include `lastSyncTime` in error logs for better debugging context.
Replaced `forEach` with `removeIf` to streamline account saving and clearing operations.
Introduced a unified `Executor` for SQL operations to simplify transaction management. Updated methods across controllers to use `startTransaction` for improved consistency and maintainability.
Updated variable initialization to use "abbreviations" as the correct key namespace, ensuring alignment with intended use and avoiding potential mismatches.
Extended error handling in `SQLiteController` to include `SQLITE_CONSTRAINT_TRIGGER` cases, improving robustness during account creation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #63