Skip to content

Conversation

@codeunia-dev
Copy link
Owner

📌 Overview

This PR introduces seamless direct messaging for mentors, allowing users to initiate a conversation directly from any Mentor Card. The system now automatically fetches mentor user IDs, validates existing conversations, and creates a new one when needed.


🔧 Key Changes

1. Mentor API Enhancements (app/api/mentors/route.ts)

  • Added logic to fetch associated user_id for each mentor.
  • Improved response shape for front-end messaging workflows.
  • Cleaned duplicated transforms and standardized naming.

2. MentorCard Integration (MentorCard.tsx)

  • Added “Message Mentor” CTA with loading/disabled states.

  • On click:

    • Fetch mentor’s user_id
    • Identify existing conversation OR create a new one
    • Redirect user to the chat thread
  • Improved UI/UX and error handling for messaging flows.

3. Conversation Service Updates (conversationService.ts)

  • Added helper to create a conversation if none exists.
  • Standardized request payloads and conversation lookup logic.
  • Removed unused params and improved type safety.

4. Types Update (types/messaging.ts)

  • Added/updated interfaces for messaging entities.
  • Ensured compatibility with new API response structure.

🎯 Benefits

  • Users can now message mentors instantly—without navigating to the chat dashboard first.
  • Cleaner, more maintainable messaging service logic.
  • Foundation for future features such as mentor-student chat history, online status, etc.

Authored by: @akshay0611

…ng user IDs and integrating conversation initiation.
@vercel
Copy link

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Ready Ready Preview Comment Nov 28, 2025 10:17am

@codeunia-dev codeunia-dev merged commit b6a997d into main Nov 28, 2025
2 of 3 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.

3 participants