Skip to content

Feat/score decay logic#684

Merged
ogazboiz merged 9 commits intoLabsCrypt:mainfrom
Skinny001:feat/score-decay-logic
Mar 31, 2026
Merged

Feat/score decay logic#684
ogazboiz merged 9 commits intoLabsCrypt:mainfrom
Skinny001:feat/score-decay-logic

Conversation

@Skinny001
Copy link
Copy Markdown
Contributor

This pull request introduces a loan dispute/appeal mechanism to the backend, adds new admin endpoints for resolving loan disputes, and refactors Swagger documentation handling to improve ESM compatibility. It also updates and expands the test suite for the new dispute flow, adds a migration for the new database table, and makes several dependency and configuration adjustments.

Loan Dispute/Appeal Mechanism:

  • Added a new migration to create the loan_disputes table, supporting open/resolved/rejected statuses and linking disputes to loans. This lays the groundwork for tracking and resolving loan disputes.
  • Implemented admin controller endpoints for listing and resolving loan disputes, allowing admins to confirm or reverse loan defaults with appropriate audit events.

Testing Enhancements:

  • Introduced a comprehensive test suite (loanDispute.test.ts) covering borrower and admin dispute flows, including contesting defaults, freezing penalties during disputes, and admin resolutions.
  • Improved mocking and test setup in loanEndpoints.test.ts for more reliable and isolated test cases, including proper query resets and dispute checks. [1] [2] [3] [4]

Swagger Documentation Refactor:

  • Moved Swagger config to a new ESM-compatible file (swagger.esm.ts) and updated the app to mount Swagger docs only in a dedicated entrypoint (app.with-swagger.ts). This avoids ESM/CJS issues and cleans up the main app file. [1] [2] [3] [4] [5]

Configuration and Dependency Updates:

  • Updated jest.config.ts for better ESM support, custom test matching, and improved setup, and fixed Jest and TypeScript type versions for compatibility. [1] [2] [3]
  • Added a minimal .env.test for test environment variables.
  • Added express as a dependency in the backend package.

These changes collectively enable a full borrower dispute/appeal workflow, admin review and resolution, and robust test and documentation support for the new features.

close #535

Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz left a comment

Choose a reason for hiding this comment

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

hey @Skinny001, same issues as #683 and #674:

  1. migration conflict - 1783000000013_add-loan-disputes.js is already taken on main. next available is 1784000000014.

  2. stray files - backend/backend/ directory, app.with-swagger.ts, swagger.esm.ts shouldn't be here.

  3. scope - 36 files across disputes, score decay, auth, notifications, pool, and more. the score decay logic is the new part here but it's bundled with everything from #683. please split the score decay into its own focused PR.

also you now have 3 open PRs (#674, #683, #684) that all carry the same stray files and migration conflict. would be much easier to fix the base issues once and submit clean, focused PRs from there.

@ogazboiz ogazboiz merged commit edfda5c into LabsCrypt:main Mar 31, 2026
4 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.

feat(contracts,backend): implement credit score decay for inactive borrowers

2 participants