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

Enhance Wallet Management, Standardize Models, and Improve Security #6

Merged
merged 5 commits into from
Feb 24, 2025

Conversation

AlpTalhaYazar
Copy link
Collaborator

This pull request introduces significant enhancements to the Financial Management API, focusing on wallet management, security, model standardization, and improved pagination and validation. Below is a breakdown of the key changes:

Wallet Management Enhancements

  • Added comprehensive endpoints for wallet operations:
    • Create, list, update, and delete wallets.
    • Manage wallet accessors, including creating, updating, and deleting shared access.
    • Enhanced wallet type management with platform-specific requirements.
  • Improved transaction handling for wallets, including listing transactions and managing balances.

Security Improvements

  • Updated authentication middleware to properly handle and verify Bearer tokens.
  • Ensured all endpoints requiring authentication are secured with JWT tokens.

Model Standardization

  • Introduced a base model schema (base.model.ts) to standardize common fields across models.
  • Updated existing models (e.g., User, Wallet, Transaction) to inherit from the base model, ensuring consistency.
  • Added new models for Subscription and Installment to support recurring transactions.

Pagination and Query Handling

  • Improved pagination logic in controllers and helpers to provide consistent metadata across endpoints.
  • Refined query-helper.ts to handle pagination more explicitly and efficiently.

OpenAPI Documentation

  • Updated the OpenAPI specification (openapi.json) to reflect new and modified endpoints.
  • Added detailed descriptions and examples for better API understanding and usability.

Validation Enhancements

  • Refined validation schemas for transactions, wallets, and other entities to ensure data integrity.
  • Updated request models (e.g., wallet.dto.ts) to enforce stricter validation rules.

Codebase Refactoring

  • Renamed directories (e.g., helper to helpers) for better clarity.
  • Split request and response models into separate directories (requestModel and responseModel) for improved organization.
  • Applied consistent naming conventions and improved type safety across the codebase.

These changes aim to make the API more robust, secure, and maintainable while providing enhanced functionality for wallet management and transaction handling.

- Create new base transaction schema with common transaction fields
- Implement new transaction, subscription, and installment models
- Update transaction controller to use new model structure
- Modify transaction validation schema to match new model
…updates

- Refactor wallet models with base schema and enhanced interfaces
- Add new wallet creation DTO with comprehensive validation
- Update OpenAPI specification with wallet routes and security definitions
- Modify authentication middleware to use bearer token extraction
- Implement decorator-based route and OpenAPI metadata generation
- Enhance wallet controller with class-based structure and method decorators
- Remove undefined security from auth routes
- Add bearer authentication security to wallet controller methods
- Update decorator factory to support flexible security configuration
…tation

- Refactor query helper to use type-safe pagination parameters
- Add new PaginationRequestParameters DTO for consistent pagination
- Update controllers to use new pagination helper with async support
- Modify wallet and other models to improve type definitions and methods
- Reorganize import paths for request and response models
@AlpTalhaYazar AlpTalhaYazar added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 24, 2025
- Add population for createdBy, walletType, and walletBalances in wallet query
- Optimize pagination helper by pre-calculating total items count
- Improve query efficiency with `.clone()` for total items calculation
const { metadata } = queryHelper({
queries: { ...req.query, totalItems },
const { metadata } = await queryHelper({
queryStrings: PaginationRequestParameters.parse(req.query),
Copy link
Owner

Choose a reason for hiding this comment

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

just pass req.query here and use PaginationRequestParameters.parse( inside of it. By this way we won't import it everywhere

@mucahidyazar mucahidyazar merged commit 5d523f5 into main Feb 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants