ankitbisen28 / Atelier

Letest web app for custom clothing, Using React vite and Nodejs
https://atelier-client.vercel.app/
0 stars 1 forks source link

Feature Request: Display Consumer Details on Project Detail View #11

Open ankitbisen28 opened 2 weeks ago

ankitbisen28 commented 2 weeks ago

Description

When a maker clicks on any project's detail, they should be able to see the basic details of the consumer who posted the project. This information should appear below the project details.

Requirements

  1. Project Detail View:

    • When a maker clicks on a project, they should be taken to the project detail view.
    • The project detail view should display all relevant information about the project.
  2. Consumer Details Display:

    • Below the project details, display a section with the consumer's basic details.
    • The consumer details should include:
      • Name
      • Profile picture
      • Contact information (e.g., email, phone number)
      • Brief bio or description
    • Ensure the consumer details section is visually distinct and easy to locate.

Acceptance Criteria

Additional Information

Mockups / Examples

Provide any mockups or examples of the desired component if available.

Technical Requirements

Steps to Implement

  1. Update Backend Endpoint:

    • Modify the project detail endpoint to include consumer information.
    const express = require('express');
    const router = express.Router();
    const Project = require('../models/project');
    const User = require('../models/user');
    
    router.get('/projects/:id', async (req, res) => {
        try {
            const project = await Project.findById(req.params.id).lean();
            if (!project) {
                return res.status(404).json({ message: 'Project not found' });
            }
            const consumer = await User.findById(project.consumerId).lean();
            res.status(200).json({ project, consumer });
        } catch (error) {
            res.status(500).json({ message: 'Failed to fetch project details', error });
        }
    });
    
    module.exports = router;
  2. Update Frontend Component:

    • Fetch and display the consumer details in the project detail view.
  3. Integrate and Test:

    • Ensure the backend and frontend components are integrated correctly.
    • Test the feature thoroughly to ensure the consumer details are displayed as expected.

Tasks