manikumarreddyu / AgroTech-AI

AgroTech AI platform is a comprehensive web-based tool where users can access various machine learning models for making accurate predictions related to agriculture
https://agro-tech-ai.vercel.app
MIT License
69 stars 115 forks source link

Add Return Product Schema and Controllers with Advance feature #883

Open IkkiOcean opened 2 hours ago

IkkiOcean commented 2 hours ago

Description:

We need to implement a Return Product feature in the AgroShop platform to allow users to return rented products. This will involve creating a new schema to store information about returns and developing controllers to handle the logic behind returning products.

The following changes are required:

The product return functionality should integrate with the current rental system, and it should allow:


Acceptance Criteria:

  1. Return Product Schema:

    • The schema should have the following fields:
      • rentalProductId: Reference to the rented product.
      • userId: Reference to the user who rented the product.
      • returnDate: Date when the product is returned.
      • condition: String to indicate the condition of the returned product (e.g., "good", "damaged").
      • status: Enum field to represent the status of the return (e.g., "pending", "returned", "approved", "rejected").
      • createdAt: Timestamp of when the return request was created.
      • updatedAt: Timestamp of when the return status was last updated.
  2. Return Product Controllers:

    • Create Return (POST /api/returns):
      • Users should be able to submit a return request by providing the product ID and any necessary return details (e.g., condition, return date).
    • Update Return Status (PATCH /api/returns/:id):
      • Admins should be able to update the return status (approve, reject, etc.) and track the condition of returned items.
    • Get Return Information (GET /api/returns/:id):
      • Users and admins should be able to retrieve return details for the respective rented product.
  3. Validation:

    • Ensure that the return request is only submitted for products that are marked as "rented" and are eligible for return.
    • Ensure that the return status can only be updated by an admin.
    • Return information should be correctly updated and available for both users and admins.
github-actions[bot] commented 2 hours ago

Thank you for creating this issue! 🎉 We'll look into it as soon as possible. In the meantime, please make sure to provide all the necessary details and context. If you have any questions or additional information, feel free to add them here. Your contributions are highly appreciated! 😊

You can also check our CONTRIBUTING.md for guidelines on contributing to this project.