feat: implement settlements repository (#17)#91
Open
Chucks1093 wants to merge 2 commits intoCalloraOrg:mainfrom
Open
feat: implement settlements repository (#17)#91Chucks1093 wants to merge 2 commits intoCalloraOrg:mainfrom
Chucks1093 wants to merge 2 commits intoCalloraOrg:mainfrom
Conversation
Author
|
@greatest0fallt1me please can you quickly merge this .thanks |
Contributor
|
please resolve the conflicts |
- Add Prisma schema with Settlement model and SettlementStatus enum - Add migration creating settlements table with indexes on developerId and status - Add SettlementRepository with create, findById, listByDeveloper, updateStatus, getPendingSettlementTotal - Inject PrismaClient via constructor for testability - Add full unit tests with jest-mock-extended covering all methods and edge cases - Rename jest.config.js to jest.config.cjs to fix ESM/CJS conflict
1bee534 to
cb287e3
Compare
Author
Contributor
|
@Chucks1093 Can you resolve the conflicts? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17
Summary
Implements a complete settlements persistence layer with Prisma, including schema, migration, repository methods, and isolated unit tests.
Changes
prisma/schema.prismawith:SettlementmodelSettlementStatusenum:pending | completed | failedsettlementstable with indexes on:developerIdstatussrc/db.tsas a Prisma client singletonSettlementRepositorywith all required methods:create(developerId, amountUsdc, status)findById(id)listByDeveloper(developerId, limit, offset)updateStatus(id, status, txHash)txHashforcompletedcompletedAtandstellarTxHashon completiongetPendingSettlementTotal(developerId)"0"when no pending settlements existjest.config.jstojest.config.cjsto resolve ESM/CJS config loading conflictTesting
jest-mock-extended(no real DB required)findByIdfound/not-found pathslistByDeveloperpagination and orderingupdateStatustransitions and validation edge casesgetPendingSettlementTotalincluding empty/null sumsnpm run typechecknpm test