Add Order Schema and CRUD Controllers #875
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces the
Order
schema to the application, along with the following controllers for order management:updateOrderItemQuantity
removeItemFromOrder
addItemToOrder
getOrderById
deleteOrder
updateOrderStatus
getOrders
createOrder
bulkUpdateOrderStatus
getOrderStatusHistory
getOrdersByStatus
getAllOrdersForAdmin
These changes provide the necessary logic and structure for managing orders within the system, supporting both individual and bulk actions, as well as facilitating administrative control over order status.
Changes:
1. Order Schema:
Order
has been added to the database to manage the order details, including item information, customer details, order status, and timestamps.2. Controllers Added:
updateOrderItemQuantity
: Updates the quantity of a specific item in an existing order.removeItemFromOrder
: Removes an item from an order.addItemToOrder
: Adds an item to an existing order.getOrderById
: Retrieves a specific order by its ID.deleteOrder
: Deletes an order from the system.updateOrderStatus
: Changes the status of an order (e.g., pending, shipped, delivered).getOrders
: Retrieves a list of orders, possibly filtered by parameters like status or date.createOrder
: Creates a new order and adds it to the system.bulkUpdateOrderStatus
: Updates the status of multiple orders in one request.getOrderStatusHistory
: Retrieves the status change history for a specific order.getOrdersByStatus
: Retrieves orders filtered by their current status.getAllOrdersForAdmin
: Retrieves all orders, primarily for administrative use.Related Issues: