Skip to content

fix: Adressed sub-services, mapper for entity, Vault query simple pat…#402

Open
Sadeequ wants to merge 1 commit into
code-flexing:mainfrom
Sadeequ:finalfix
Open

fix: Adressed sub-services, mapper for entity, Vault query simple pat…#402
Sadeequ wants to merge 1 commit into
code-flexing:mainfrom
Sadeequ:finalfix

Conversation

@Sadeequ
Copy link
Copy Markdown

@Sadeequ Sadeequ commented May 31, 2026

I have successfully addressed all four issues as follows:

  • For splitting StellarService: I analyzed the 500+ line service and identified three distinct concerns: escrow, payments, and account management. I created three new services (EscrowService, PaymentService, AccountService) in backend/src/stellar/services/, moved the relevant methods to each, updated StellarService to act as a lightweight facade, and refactored all usages across the codebase. I also wrote comprehensive unit tests for each new service.

  • For adding mapper services: I identified scattered entity-to-DTO conversion logic in services and controllers. I created a new src/mappers directory and implemented VaultMapper and DepositMapper classes using class-transformer for automated mapping. I replaced all inline conversion calls with mapper invocations, ensuring consistent transformation patterns. I added
    test suites for both mappers covering edge cases.

  • For implementing the Specification pattern: I located inline TypeORM where conditions in vault repositories and services. I created an abstract Specification class with concrete implementations for ActiveVaultSpec, OwnedByUserSpec, and BelowCapacitySpec, each encapsulating query logic. I refactored all vault queries to compose these specifications using and/or methods, significantly improving reusability. I added unit tests verifying each specification's SQL output.

  • For adding pre-commit hooks: I installed husky and lint-staged as dev dependencies, configured a pre-commit hook via husky, and set up lint-staged to run eslint and tsc --noEmit on staged TypeScript files. I added a prepare script to package.json for automatic setup and verified the hooks catch lint errors before commits, eliminating CI failures from style issues.

RELATED ISSUES

CLOSES #380 ✔️

CLOSES #386 ✔️

CLOSES #387 ✔️

CLOSES #388 ✔️

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

@Sadeequ is attempting to deploy a commit to the vic's projects Team on Vercel.

A member of the Team first needs to authorize it.

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