Conversation
This refactor decouples the audit log persistence logic from the bot's internal database to an external API. It replaces direct database calls with a new persistence SDK (AuditLogRegistration, AuditLogRequestDTO, ErrorResponse) that communicates with the API using Unirest. This change promotes a more modular and scalable architecture, allowing for centralized data management and preparing for a dedicated persistence layer or microservices approach. The AnnouncementCommandListener was also removed as it is no longer needed.
refactor(api): standardize api call responses Introduces a generic ApiResponse wrapper for all API calls. This improves error handling by explicitly separating success and error payloads, enhancing type safety and readability. The change also reorganizes audit log related DTOs and classes into a dedicated package for better module organization. Updates audit log command listener to consume the new ApiResponse. ```
The audit log setup command listener has been refactored to utilize the persistence SDK for all audit log management. This includes channel registration, retrieval, and removal. The change decouples the listener from direct database access. Additionally, a constant in the audit log persistence SDK was renamed for improved adherence to Java naming conventions. Benefits: - Improves modularity and maintainability by separating concerns. - Centralizes persistence logic within a dedicated API client. - Enhances code consistency and readability.
refactor(api): migrate message and audit log persistence to api sdk Decouples log setup from direct database interaction, promoting a cleaner architecture. Centralizes API calls within dedicated SDK classes, improving maintainability and reusability. Standardizes API interaction patterns using ApiResponse and ErrorResponse. ```
refactor(api): reorganize persistence sdk package and class names Refactor the persistence SDK by introducing dedicated 'call' and 'response' sub-packages. Rename API call classes with a 'Call' suffix and response objects with an 'Object' suffix for improved clarity and consistency. The base ApiResponse class is also moved to the new response package. Added package-info.java for persistencesdk documentation. This refactoring enhances the modularity and maintainability of the SDK, making it easier to understand the purpose of each class within the persistence layer and promoting clearer separation of concerns. ```
refactor(api): rename persistence sdk package to sdk The package name org.papertrail.persistencesdk was renamed to org.papertrail.sdk. This change simplifies the SDK's identifier, making it more concise and general. It prepares the SDK for potential future expansions beyond persistence-specific functionalities, enhancing its clarity and consistency within the project. ```
refactor(api): migrate data persistence to external api Removes all local database integration, including JOOQ, HikariCP, and local data access objects. All data operations, such as guild registration for audit and message logs, and message content logging, are now handled via calls to an external API. This change decouples the bot from direct database management, simplifying deployment and setup. It shifts data storage and management to a dedicated backend service, improving scalability and maintainability through better separation of concerns. Additionally, it reduces the bot's local footprint and resource usage by offloading database operations. ```
Reduces project footprint and build times by removing unneeded database connection and ORM libraries.
refactor(api): restructure sdk packages and rename api classes Renames `sdk/call` package to `sdk/client` and `sdk/response` to `sdk/model` to improve clarity and align with common API client patterns. Updates class names to remove `*Object` suffixes and renames `ApiResponse` to `ApiResult` for better semantics regarding API call outcomes. This enhances code readability and maintainability by using more descriptive and standard terminology for API interaction components. ```
Removed the Announcement Command
Move the initial guild registration API calls within message event listeners to virtual threads. Earlier, the calls were offloaded to the listener thread itself.
This refactors the audit log and message log commands to use Discord's subcommand feature. Instead of separate top-level commands like `/auditlogchannel-set`, commands are now grouped under `/auditlog set` and `/messagelog set`. This change improves the user experience by reducing the number of top-level commands and enhancing the discoverability and organization of related functionalities.
Update the application's version string to reflect its beta status. Temporarily disable the slash command registrar to prevent unnecessary re-registration of commands on every startup.
This change adopts the official Spring Boot Maven Plugin for packaging the application with dependencies.
Include the exception class name and stack trace in error responses to provide more detailed information for debugging and error analysis.
Adjusted the default logging level from debug to info in tinylog.properties and changed lock acquisition/release messages to debug level.
Rephrases the descriptions for message pinning and unpinning events in the audit log. This improves clarity by explicitly stating that a message *from* and not *by* someone, was pinned/unpinned
Introduces basic authentication using API key for all HTTP requests in AuditLogClient, MessageContentLogClient, and MessageLogClient. This change improves security by ensuring all API calls are authenticated.
This reverts commit 13ba3c0.
Replaces ApiResult with HttpServiceResponse across all SDK clients and listeners. Introduces HttpServiceEngine and HttpServiceResponse for unified HTTP request handling. Updates method signatures and usages to reflect the new response type and success/error checks. Removes the old ApiResult class.
Switched JSON serialization from Jackson to Gson throughout the codebase, updating dependencies and removing Jackson-specific configuration. Corrected HTTP methods in MessageContentLogClient and MessageLogClient to use GET and DELETE where appropriate, ensuring proper RESTful API usage.
Eliminated unnecessary check for void or blank response bodies in HttpServiceEngine. The method now always attempts to deserialize the response body if the request is successful.
Sdk refactor
This change replaces OpenJDK with IBM Semeru Runtime for the final Docker image.
Bumped the Maven distribution URL from 3.9.9 to 3.9.11 in maven-wrapper.properties to use the latest Maven release.
feat(api): split long messages for embed fields Discord embed fields have a character limit of 1024. This change ensures that messages exceeding this limit are split into multiple fields, preventing truncation and allowing the full message content to be displayed in the log embeds for both message edit and delete events.
Replaces the Unirest HTTP client library with Spring's RestClient and introduces Vavr's Either for functional error handling. This change refactors the HttpServiceEngine, all API clients, and updates DTOs and API response handling in listeners. Benefits: - Improves error handling with explicit success/failure states using Either. - Adopts a modern and actively maintained HTTP client. - Enhances consistency and maintainability of API interactions.
refactor(api): replace unirest with spring restclient and vavr
|
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
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.


Key Changes
1. Decoupling Persistence
2. Persistence SDK
org.papertrail.sdkpackage for API interactions.3. Listener & Command Refactors
AuditLogSetupCommandListenerand message log listeners updated to consume the new SDK./auditlog set,/messagelog set) .4. Message Logging Enhancements
5. Infrastructure & Build Updates
6. Backwards Compatibility