Skip to content

Qa/cycle 10#48

Merged
Wadprog merged 15 commits intomainfrom
qa/cycle-10
Feb 1, 2026
Merged

Qa/cycle 10#48
Wadprog merged 15 commits intomainfrom
qa/cycle-10

Conversation

@Wadprog
Copy link
Collaborator

@Wadprog Wadprog commented Feb 1, 2026

Overview

Brief description of what this PR does, and why it is needed.

Closes: VWN-XXX
Type of Change:

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Security enhancement

Demo

Optional. Screenshots, curl examples, etc.

Breaking Changes

⚠️ List any breaking changes and migration steps required

Security Considerations

🔒 Any security implications, new permissions, or sensitive data handling

Performance Impact

Expected performance impact (positive, negative, or neutral) and any load testing performed

Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

Checklist for Author

Code Quality

  • Code follows project style guidelines and best practices
  • Code is well documented with clear comments
  • No commented-out code or debug statements left behind
  • Variable and function names are descriptive and consistent

Testing

  • Unit tests have been added/updated and pass locally
  • Integration tests have been written and pass
  • Manual testing completed for the feature/fix
  • Edge cases and error scenarios have been tested
  • Browser compatibility tested (if frontend changes)

Database & Infrastructure

  • Database migrations created and tested (if schema changes)
  • New environment variables added to serverless config and SSM
  • AWS permissions granted in serverless config for new services
  • Configuration changes documented

Documentation

  • README updated (if needed)
  • API documentation updated (if applicable)
  • Deployment notes added (if special steps required)

Security & Performance

  • Security review completed (if handling sensitive data)
  • Performance impact assessed
  • No secrets or sensitive data exposed in code

Checklist for Reviewer

Functional Review

  • The changes have been pulled locally and tested manually
  • Feature meets acceptance criteria from the ticket
  • Edge cases and error scenarios work as expected
  • UI/UX changes reviewed and approved (if applicable)

Code Review

  • Code follows Engineering Guidelines
  • Architecture and design patterns are appropriate
  • No obvious security vulnerabilities
  • Error handling is appropriate
  • Logging is adequate for debugging

Integration Review

  • Changes tested with frontend applications (if backend changes)
  • Database migrations reviewed and tested
  • Environment variable changes verified
  • Deployment process reviewed

Testing Instructions

Prerequisites:

  • List any setup required (environment variables, services, etc.)

Test Cases:

  1. Happy Path Testing:

    • Step-by-step instructions for main functionality
    • Expected results
  2. Edge Case Testing:

    • Test invalid inputs, boundary conditions
    • Expected error handling
  3. Integration Testing:

    • Test with other system components
    • Verify API contracts (if applicable)

Regression Testing:

  • Existing functionality still works as expected
  • No unintended side effects observed

Deployment Notes

Pre-deployment checklist:

  • Environment variables configured
  • Database migrations ready
  • Feature flags configured (if applicable)

Post-deployment verification:

  • Health checks pass
  • Monitoring and alerts configured
  • Rollback plan documented

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced conversation management system supporting direct and group conversations with metadata.
    • Enhanced message status tracking using date-based read and delivered indicators instead of boolean flags.
    • Improved friendship request management with acceptance notifications.
  • Refactoring

    • Simplified conversation model by removing message count tracking logic.
    • Updated message state detection to rely on timestamps for read and delivered status.

✏️ Tip: You can customize this high-level summary in your review settings.

@Wadprog Wadprog merged commit 13f38b6 into main Feb 1, 2026
2 of 4 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces a complete conversation and messaging system by creating database migrations for conversations, messages, and user participation tracking, establishing corresponding Sequelize models with proper relationships, updating service configurations for conversation and message handling, and refactoring hooks to support state management via date fields instead of boolean flags.

Changes

Cohort / File(s) Summary
Database Migrations
migrations/20260103212326-create-conversations-table.js, migrations/20260103212327-create-messages-table.js, migrations/20260103212328-create-conversation-users-table.js
Creates three new PostgreSQL tables: conversations with type ENUM and metadata; messages with foreign keys to users and conversations; conversation_users as a junction table for many-to-many relationships. All include indexes on foreign keys and type columns for query performance.
Database Models - Core Entities
src/database/conversation.ts, src/database/message.ts, src/database/conversation-user.ts
Refactors Conversation model to remove message-count logic and add group metadata fields (groupName, groupDescription, groupPicture); replaces Message boolean state fields (read, received) with date-based fields (readDate, receivedDate) and renames senderId to userId; introduces ConversationUser join table model with composite primary key and BelongsTo associations.
Database Model Updates
src/database/user.ts, src/database/index.ts
Adds coverPicture column and HasMany association to User model; uncomments and exports previously disabled Message, Conversation, and ConversationUser models from the database index.
Hooks Infrastructure
src/Hooks/Refetch.ts, src/Hooks/NestedPath.ts, src/Hooks/index.ts
Introduces new Refetch hook factory for fetching updated records after mutations; adds explicit return type annotation to NestedPath hook; exports refetch to public API.
Service Hooks - Message Handling
src/services/message/hooks/AdjustReadAndReceivedDate.ts, src/services/message/hooks/addSender.ts, src/services/message/hooks/includeSenderAndConversation.ts, src/services/message/hooks/incrementDecrementMessageInConversation.ts, src/services/message/hooks/publishMessage.ts, src/services/message/hooks/index.ts
Simplifies read/delivered state updates to set date fields; renames senderId to userId in AutoAssign; changes User association alias from 'sender' to 'user' and removes Media association; reimplements message count adjustment with direct conversation service patching; removes publishMessage hook and its export.
Message Service
src/services/message/message.class.ts, src/services/message/message.hooks.ts
Refactors create method to use base Feathers service; adds NestedPath to before.find and before.create; replaces PublishMessage with refetch hook; updates before.patch to use single hook instead of array.
Conversation Service
src/services/conversation/conversation.service.ts, src/services/conversation/conversation.hooks.ts, src/services/conversation/hook/filterConversation.ts, src/services/conversation/hook/getUnreadMessage.ts, src/services/conversation/hook/limitConversationToTalkersOnly.ts, src/services/conversation/hook/limitDirectConversation.ts
Configures conversation service with dedicated Model and Message nested service; updates hook configuration to use refetch and AddTalker in error handlers; converts all SQL queries to snake_case naming conventions; refactors direct conversation creation to check for existing user pairs and adds self-conversation validation.
Conversation Hook Updates
src/Hooks/AddTalker.ts
Changes ConversationUser model reference, updates field names (userId, conversationId), adds conditional amountOfPeople update only for group conversations, and adjusts error handling to rethrow as GeneralError.
Friendship Service
src/services/friendships/friendship.class.ts, src/services/friendships/friendship.hook.ts, src/services/friendships/friendship.service.ts
Adds find method to filter accepted friendships with proper user exclusion; reorganizes before hooks to run AddTargetUser on find and create; adds after.patch hook for friend request acceptance notifications; updates publish notification logic to use usersToNotify array.
Service Initialization
src/services/index.ts
Uncomments and enables conversation service import and initialization in the services array.
Code Cleanup
src/services/users/users.class.ts
Removes commented-out Cognito-based create/get method scaffolding.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ConvService as Conversation Service
    participant MsgService as Message Service
    participant DB as Database
    participant UserService as User Service

    Client->>ConvService: create(direct conversation)
    activate ConvService
    ConvService->>ConvService: LimitDirectConversations hook
    ConvService->>DB: Check for existing conversation
    alt Conversation exists
        ConvService->>UserService: Fetch conversation with users
        ConvService-->>Client: Return existing conversation
    else New conversation
        ConvService->>DB: Insert conversation
        ConvService->>DB: Insert conversation_users records
        ConvService->>ConvService: AddTalker hook (error handler)
        ConvService->>DB: Create conversation_users join
        ConvService->>ConvService: refetch hook (error handler)
        ConvService->>DB: Fetch updated conversation
        ConvService-->>Client: Return new conversation
    end
    deactivate ConvService

    Client->>MsgService: create(message in conversation)
    activate MsgService
    MsgService->>MsgService: NestedPath + AddSender hooks
    MsgService->>DB: Set userId from context
    MsgService->>DB: Insert message
    MsgService->>MsgService: refetch hook
    MsgService->>DB: Fetch updated message with user
    MsgService->>ConvService: patch(amountOfMessages)
    ConvService->>DB: Update conversation counts
    MsgService-->>Client: Return message with user details
    deactivate MsgService
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Qa/cycle 1 #29: Modifies src/Hooks/NestedPath.ts with TypeScript signature updates that this PR also touches and builds upon.
  • Qa/cycle 8 #39: Updates src/database/user.ts to add coverPicture column property that overlaps with modifications in this PR.

Poem

🐰 Conversations bloom like clover in spring,
Messages hop from user to user,
Database tables dance in formation,
With date-based states (no more booleans, hooray!),
A messaging burrow, nested and true! 🌿✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch qa/cycle-10

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant