Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Implement CRUD operations for products within an organization #658

Open
6 tasks
Am0du opened this issue Aug 27, 2024 · 0 comments
Open
6 tasks

Feat: Implement CRUD operations for products within an organization #658

Am0du opened this issue Aug 27, 2024 · 0 comments

Comments

@Am0du
Copy link
Contributor

Am0du commented Aug 27, 2024

Description:
Implement the following CRUD (Create, Read, Update, Delete) operations for managing products within an organization:

  1. Create a Product

    • Endpoint: POST /organisation/{org_id}/products
    • Description: Allows an admin user to create a product under a specific organization.
    • Pre-Authorization: Admin role required.
  2. Delete a Product

    • Endpoint: DELETE /products/{product_id}
    • Description: Allows an admin user to delete a product by its ID.
    • Pre-Authorization: Admin role required.
  3. Edit a Product

    • Endpoint: PUT /products
    • Description: Allows an admin user to edit an existing product.
    • Pre-Authorization: Admin role required.

Acceptance Criteria:

  • The POST /organisation/{org_id}/products endpoint creates a product under the specified organization.
  • The DELETE /products/{product_id} endpoint deletes the specified product.
  • The PUT /products endpoint updates the specified product with new data.
  • Each endpoint should check if the authenticated user belongs to the organization and has the required role.
  • Appropriate HTTP status codes should be returned (201 for creation, 204 for deletion, 200 for updates).
  • Proper exception handling should be implemented for cases such as unauthorized access or resource not found.

Error Handling:

  • Unauthorized access should throw an UnAuthorizedException with a 403 status code.
  • Product not found should throw a NotFoundException with a 404 status code.
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

No branches or pull requests

1 participant