Skip to content

feat(sqlite): Add ReassignCategoryFromMonth to expense repo#19

Merged
madalinpopa merged 9 commits intomainfrom
branch/push-nomozkzywnwn
Jan 30, 2026
Merged

feat(sqlite): Add ReassignCategoryFromMonth to expense repo#19
madalinpopa merged 9 commits intomainfrom
branch/push-nomozkzywnwn

Conversation

@madalinpopa
Copy link
Copy Markdown
Owner

No description provided.

Allows reassigning all expenses from one category to another for a given
month.
Implements method to reassign all expenses from one category to
another for a given month.
Adds coverage for reassigning expense categories for a specific month.
Reassign expenses to the new category for the selected month when a
recurrent category is forked.
Refactor category use case tests to accept and inject a mock
ExpenseRepository, enabling more precise control and assertions in
future tests involving expense-category interactions.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @madalinpopa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a crucial feature for managing expense categories by enabling the reassignment of expenses from one category to another for a specified month. This functionality is seamlessly integrated into the category update process, particularly for recurrent categories, ensuring that historical expense data remains accurate and aligned with category changes over time. This enhancement improves the flexibility and maintainability of expense categorization.

Highlights

  • New Repository Method: A new method, ReassignCategoryFromMonth, has been added to the ExpenseRepository interface and its SQLite implementation. This method allows for updating the category of expenses from a specific category to another within a given month.
  • Category Use Case Integration: The CategoryUseCaseImpl now utilizes the new ReassignCategoryFromMonth method. When a recurrent category is updated and results in a fork for a future month, all expenses associated with the old category in that month are automatically reassigned to the newly forked category.
  • Comprehensive Testing: New unit tests have been added for the ReassignCategoryFromMonth functionality in the SQLite expense repository. Additionally, the CategoryUseCase tests have been updated to mock the ExpenseRepository and verify the correct invocation of the reassign method during category updates.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to reassign expenses from one category to another, starting from a specified month. This is primarily used when forking a recurrent category. The implementation is logical and includes relevant tests. My main feedback concerns a potential security issue in the new ReassignCategoryFromMonth repository method, which currently doesn't scope the database update to a specific user. I've provided a suggestion to add user ID scoping to enhance security and data integrity.

Comment thread internal/infrastructure/storage/sqlite/expense_repository.go Outdated
Ensure ReassignCategoryFromMonth only updates expenses belonging to
the specified user by adding userID to the query and method signature.
Update tests accordingly.
Update category use case and mocks to require userID when reassigning
categories for a given month. Adjust tests and mock signatures
accordingly.
@madalinpopa madalinpopa merged commit e0aa793 into main Jan 30, 2026
6 checks passed
@madalinpopa madalinpopa deleted the branch/push-nomozkzywnwn branch January 30, 2026 20:18
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.

1 participant