feat(agreement-chat): Add chat system with participant tracking and a…#105
Open
SudiptaPaul-31 wants to merge 2 commits into
Open
feat(agreement-chat): Add chat system with participant tracking and a…#105SudiptaPaul-31 wants to merge 2 commits into
SudiptaPaul-31 wants to merge 2 commits into
Conversation
|
@SudiptaPaul-31 is attempting to deploy a commit to the ManuelJG's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Implements production-ready agreement chat with
sender_idsupport and enforces proper participant validation. Backend now correctly handles A↔B bidirectional messaging with database persistence and access control.closes #86
Changes
1. SQL Migration:
scripts/003_add_agreement_chat.sqlagreement_participantstable withagreement_idFK,wallet_address,role, andprofile_idFKagreement_messagestable withsender_id(UUID, FK toauth.users),sender_wallet, and message contentagreement_activitytable for audit trailagreement_id,sender_id,created_atfor performance2. Updated:
src/agreements/agreements.service.tsBefore: If
agreement_participantsinsert failed, we silently logged error and continued, leaving orphaned agreementsAfter: Now throws
BadRequestExceptionif participant creation fails, ensuring atomic agreement + participant creation3. Updated:
src/agreement-chat/agreement-chat.service.tsBefore: Returned
{ message: null, error: string }tuples (always 200)After: Throws proper NestJS exceptions:
BadRequestException(400) for database errors and validation failuresForbiddenException(403) for unauthorized access (non-participants)NotFoundException(404) for missing agreementsEnsures only JWT users who are creator/participant can access messages.
4. Updated:
src/agreement-chat/agreement-chat.controller.tsMade controller methods
asyncto properly await and propagate exceptions. NestJS automatically converts thrown exceptions to appropriate HTTP status codes.5. Updated:
src/integration/migrated-flows.integration.spec.tsAdded 7 new integration tests verifying the production-ready chat:
sender_id→ participant receives itsender_walletrejected with 403Test Results: All 17 tests passing (10 existing + 7 new)
Acceptance Criteria
sender_id+sender_walletTesting
npm run test:integration # Result: Test Suites: 1 passed, Tests: 17 passed