anasakil / artisan

https://artisan-hazel.vercel.app
MIT License
1 stars 1 forks source link

Enhance Seller Privileges for Managing Products and Viewing Orders #12

Open anasakil opened 6 months ago

anasakil commented 6 months ago

To enhance the functionality and security of our marketplace platform, we need to ensure that sellers have the capability to create, read, update, and delete (CRUD) only their products. Additionally, sellers should be able to view orders related to their products. This update requires modifications to both the product and order management logic to enforce these restrictions effectively.

Tasks:

  1. Update Product Management Permissions:

    • Revise the product CRUD operations in productController.js to validate the seller's identity against the product owner before allowing any modifications.
    • Implement checks during product creation to associate the product with the authenticated seller's ID.
  2. Restrict Order Visibility:

    • Modify the order retrieval logic in orderController.js to ensure sellers can only view orders that include their products.
    • Consider the need for aggregating order details in a way that only displays relevant information to the seller (e.g., omitting products from other sellers in shared orders).
  3. Test New Permissions and Visibility:

    • Write unit and integration tests to verify that sellers can only manage their products and view relevant orders.
    • Ensure tests cover scenarios of unauthorized access attempts.
  4. Update API Documentation:

    • Reflect these changes in the API documentation, clearly stating the permissions and visibility rules for sellers.
  5. Inform Sellers of New Features:

    • Prepare communication to inform current sellers about the new features and any actions they need to take.

Acceptance Criteria:

Deliverables: