Skip to content
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

feat: add yearly option to billing plan DTO and fix validation issue #1355

Closed
wants to merge 4 commits into from

Conversation

AndreD17
Copy link

@AndreD17 AndreD17 commented Mar 2, 2025

Pull Request

Description

This PR resolves validation issues in BillingPlanDto to ensure:
✅ Frequency only accepts "monthly" or "yearly".
✅ Amount is properly validated as a number instead of a string

  • Frequency Field Validation
    • Added @IsIn(['monthly', 'yearly']) to enforce valid values.
    • Updated Swagger docs to reflect allowed values.
  • Amount Field Validation
    • Changed @IsNumberString()@IsNumber() to correctly handle numeric values.

Related Issue

Fixes: #120

Fixes #(issue)

Type of Change

✨ Feature: New functionality

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation updates
  • style: Code style/formatting changes
  • refactor: Code refactoring
  • perf: Performance improvements
  • test: Test additions/updates
  • chore: Build process or tooling changes
  • ci: CI configuration changes
  • other:

How Has This Been Tested?

Unit test with using jest to test validations

  • Unit tests
  • Integration tests
  • Manual tests

Test Evidence

Screenshot (150)

Screenshot (149)

Screenshots (if applicable)

Documentation Screenshots (if applicable)

{
"name": "Premium Yearly",
"description": "Yearly plan with full features",
"frequency": "yearly",
"amount": 1200,
"is_active": true
}

Checklist

  • My code follows the project's coding style
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • I have included a screenshot showing all tests passing
  • [] I have included documentation screenshots (if applicable)

Additional Notes

Further validation can be added if required, such as ensuring yearly pricing is 12x the monthly price.

@AndreD17 AndreD17 closed this Mar 2, 2025
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.

[FEAT]: Search Functionality for Products
1 participant