Skip to content

Feature/implement recurring expenses#9

Closed
Semilore317 wants to merge 59 commits into
mainfrom
feature/implement-recurring-expenses
Closed

Feature/implement recurring expenses#9
Semilore317 wants to merge 59 commits into
mainfrom
feature/implement-recurring-expenses

Conversation

@Semilore317
Copy link
Copy Markdown
Collaborator

Implements the end-to-end infrastructure for recurring transactions including automated generation, scheduling, and secure RESTful endpoints.

Semilore317 and others added 30 commits January 20, 2026 12:47
A basic spring project with the springboot dependencies added to the maven POM file. JDK 21 and Springboot 3  Database is PostgresSQL
Included postgres specifications to allow application to start
Migrated configuration from application.properties to application.yaml
…ency-and-implement-application.yaml

replaced application.properties with application.yaml and added the liquibase dependency from maven central repository
…nd ditch the previous id implementation in the TransactionServiceImpl
…troller.java to the appropriate service class
owolabiezekiel and others added 25 commits January 30, 2026 01:11
…eateTransaction-Endpoint-&-getTransactionById-Endpoint

Feature/implement create transaction endpoint & get transaction by id endpoint
…etch-transactions

add update transaction and paginated fetch endpoints
…ion and getTransactionById endpoints (#6)

* removed ResponseEntity in TransactionController for consistent dto returns

* added spotless maven plugin in pom.xml

* applied spotless formatting to all files...

* removed redundant dependency
* added jjwt dependencies in pom.xml file

* chore: ignore secrets directory

* added user entity and role-based permissions

* added relationship between user and transactions

* implemented userRepository

* added database migration xml files

* created SignupRequest

* created LoginRequest DTO

* corrected LoginRequest DTO design

* added AuthResponse DTO

* reformatted UserDto as a record and corrected error in User entity

* fixed inconsitencies in DTOs

* fixed inconsistencies in DTOs

* Successfully implemented all security components with proper formatting: JwtUtil, UserDetailsServiceImpl, JwtAuthenticationFilter, SecurityConfig, and added getPermissions() method to Role enum. Code formatting applied via Spotless

* added extra exception classes

* updated the GlobalExceptionHandler class

* added the EmailAlreadyExistsException class

* added the UsernameAlreadyExistsException class

* added the InvalidCredentialException class

* modified the GlobalExceptionHandler

* scaffolded UserService class

* implemented the userService

* removed unnecessary comments and implemented AuthController

* implemented auth controller and removed redudant comments

* fixed bug with app not starting

* fixed issue where JPA wasn't adding timestamps to base entitiy

added @EntityListener annotation and @createdat and @lastmodified date to baseEntity, this fixes the entity creation flow

* modified Filter Chain to change endpoint access

* added loggin to JwtAuthenticationFilter to detect the issue

* refactored secrets file

* fixed issue with system_admin credentials

* removed unneeded config in application.yaml

* added preAuthorize annotation to /me endpoint

* added JWT_SECRET to IDEA environment variables

@Getter
@Setter
public class RecurringUpdateBatchRequest {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I dont like this name. What is it batching?


// Find all active recurring transactions that are due for execution
// (nextExecutionDate <= today)
List<RecurringTransaction> findByIsActiveTrueAndNextExecutionDateLessThanEqual(LocalDate date);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why are you trying to fetch for transactions that are less than or equal to a date. I would expect you to break this query down into two.

  1. A query that fetches for current day. so that it can trigger the insertion of transaction.
  2. A query that takes a date range. so that it can send reminders for upcoming subscriptions.

RecurringTransaction existing =
recurringTransactionRepository
.findById(id)
.filter(rt -> rt.getUser().getId().equals(user.getId()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Find by user and Id instead so you dont have to filter

RecurringTransaction existing =
recurringTransactionRepository
.findById(id)
.filter(rt -> rt.getUser().getId().equals(user.getId()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ditto

public void runExecutionCycle() {
LocalDate today = LocalDate.now();
List<RecurringTransaction> dueTransactions =
recurringTransactionRepository.findByIsActiveTrueAndNextExecutionDateLessThanEqual(today);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what happens here is that if todays date is 24, this query will search from beginning of time till todays date. expensive query. just search for todays date since this is a job that runs daily.

}
}

private User getCurrentUser() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

on the controlller, you can add the annotation @AuthenticationPrincipal User user then you can pass that user as arguments to the methods. again, look at my sample codebase.

@Semilore317 Semilore317 closed this Apr 6, 2026
@Semilore317 Semilore317 force-pushed the feature/implement-recurring-expenses branch from 15ba464 to e13150a Compare April 6, 2026 12:46
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.

3 participants