Skip to content

Fix/dtos budget maximum allowed - #22

Merged
ryanjorgeac merged 2 commits into
mainfrom
fix/dtos-budget-maximum-allowed
Jul 1, 2026
Merged

Fix/dtos budget maximum allowed#22
ryanjorgeac merged 2 commits into
mainfrom
fix/dtos-budget-maximum-allowed

Conversation

@ryanjorgeac

Copy link
Copy Markdown
Owner

This pull request introduces validation improvements and expanded test coverage for DTOs related to categories, commitments, and transactions. It enforces stricter maximum value and length constraints on numeric and string fields, and adds comprehensive tests to ensure these validations work as expected. Additionally, it refines the formatting logic for monetary values.

Validation enhancements:

  • Added @Max(9999999999999) constraint to amountCents in CreateTransactionDto and CreateCommitmentDto, and to budgetAmount in CreateCategoryDto, ensuring these fields cannot exceed 13 digits.
  • Increased name max length in CreateCategoryDto from 20 to 40, and added @MaxLength(60) to description in CreateCommitmentDto for better flexibility and consistency.
  • Changed type in CreateTransactionDto to use @IsEnum(TransactionType) for stricter type validation.

Test coverage improvements:

  • Added unit tests for @Max constraints on amountCents in CreateTransactionDto and CreateCommitmentDto, and on budgetAmount in CreateCategoryDto, covering edge cases for maximum and minimum values.

Utility and formatting updates:

  • Refactored bigintToMoneyString to improve formatting of negative and large values, ensuring correct display with Brazilian locale and proper handling of cents.

@ryanjorgeac
ryanjorgeac merged commit d718dd0 into main Jul 1, 2026
2 checks passed
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