Skip to content

feat: Add Repository pattern for Vault entity (#633)#631

Open
raphael-01-visual wants to merge 1 commit into
code-flexing:mainfrom
raphael-01-visual:feature/issue-633-vault-repository
Open

feat: Add Repository pattern for Vault entity (#633)#631
raphael-01-visual wants to merge 1 commit into
code-flexing:mainfrom
raphael-01-visual:feature/issue-633-vault-repository

Conversation

@raphael-01-visual

Copy link
Copy Markdown

Description

Resolves #633
Related #362

What:
Extracts all direct TypeORM data access calls from VaultsService into a newly created, dedicated VaultRepository.

Why:
Previously, VaultsService was tightly coupled with TypeORM's generic Repository<Vault>. By separating the data access layer from the business logic layer, this refactoring significantly improves the testability, maintainability, and modularity of the Vaults domain.

Changes Made

  • Created VaultRepository: Added backend/src/vaults/vault.repository.ts as an abstraction layer with explicit data-access methods (findAll, findById, save, and findLeaderboard).
  • Refactored VaultsService: Replaced all TypeORM Repository<Vault> usages with calls to the new VaultRepository.
  • Updated VaultsModule: Injected and exported the VaultRepository provider where necessary.
  • Updated Tests: Adapted the VaultsService unit tests (vaults.service.spec.ts) to successfully mock and test against the new custom repository methods, ensuring 100% functionality retention.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves code structure/readability)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have updated the unit tests to pass cleanly

Closes #362
Closes #361
Closes #359
Closes #360

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@raphael-01-visual is attempting to deploy a commit to the vic's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@raphael-01-visual Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@raphael-01-visual

Copy link
Copy Markdown
Author

@vic-Gray , pls review PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant