From eba7e1a3308317a3e6d61e93f28a8d0b6d4d16d2 Mon Sep 17 00:00:00 2001 From: Oyinlola Olasunkanmi Raymond <60177090+olasunkanmi-SE@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:07:10 +0800 Subject: [PATCH] Development (#459) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * implement the menu search * fix code smell * calculate service charge * update sonar project config * update total order calculation * add cart items to order * move email header check to the backend * remove quantity from order * update selected items to include itemId * make cartitem and selectedCart Items optional in parent models * create the order service * create order controller * checkout and fix (#391) * Test (#393) * checkout and fix * fix errors and remove env from application (#392) Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#394) * fix errors and remove env from application * fix build errors Co-authored-by: Olasunkanmi Oyinlola <143487325+olasunkanmiraymond@users.noreply.github.com> Co-authored-by: Olasunkanmi Oyinlola * Test (#396) * checkout and fix * fix errors and remove env from application (#392) Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#394) * fix errors and remove env from application * fix build errors --------- Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#395) * fix errors and remove env from application * fix build errors * remove .env file from backend --------- Co-authored-by: Olasunkanmi Oyinlola --------- Co-authored-by: Olasunkanmi Oyinlola <143487325+olasunkanmiraymond@users.noreply.github.com> Co-authored-by: Olasunkanmi Oyinlola * Test (#400) * checkout and fix * fix errors and remove env from application (#392) Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#394) * fix errors and remove env from application * fix build errors --------- Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#395) * fix errors and remove env from application * fix build errors * remove .env file from backend --------- Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#399) * fix errors and remove env from application * fix build errors * remove .env file from backend * fake an error * fake an error * fake an error --------- Co-authored-by: Olasunkanmi Oyinlola --------- Co-authored-by: Olasunkanmi Oyinlola <143487325+olasunkanmiraymond@users.noreply.github.com> Co-authored-by: Olasunkanmi Oyinlola * Test (#403) * checkout and fix * fix errors and remove env from application (#392) Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#394) * fix errors and remove env from application * fix build errors --------- Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#395) * fix errors and remove env from application * fix build errors * remove .env file from backend --------- Co-authored-by: Olasunkanmi Oyinlola * Offshore dev (#399) * fix errors and remove env from application * fix build errors * remove .env file from backend * fake an error * fake an error * fake an error --------- Co-authored-by: Olasunkanmi Oyinlola * Add additional methods to the Generic Repository (#402) * Release (#386) * Development (#235) * update github workflow yaml file * rename the frontend folder * Development (#237) * update github workflow yaml file * rename the frontend folder * create the checkout button * Development (#239) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * Development (#241) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Development (#242) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * Development (#244) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * Development (#246) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * Development (#248) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * Development (#250) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * Development (#252) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * Development (#254) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * Development (#256) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * Development (#257) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * Development (#259) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * Development (#261) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * Development (#262) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * Development (#264) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * Development (#266) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * merge conflicts * Development (#267) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * Development (#269) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * Development (#271) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * Development (#273) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * Development (#274) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * Development (#276) * Development (#277) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * Development (#279) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Development (#287) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * Development (#290) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Development (#292) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Development (#295) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Development (#297) * Development (#298) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * Development (#300) * Development (#301) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * Development (#303) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * create the localstorage utility functions * remove uuid package * remove crypto declaration * save state in local storage * persist cart state in local storage * Development (#306) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * create the localstorage utility functions * remove uuid package * remove crypto declaration * save state in local storage * persist cart state in local storage * Display list of car items * Development (#308) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * create the localstorage utility functions * remove uuid package * remove crypto declaration * save state in local storage * persist cart state in local storage * Display list of car items * implement remove item from cart * Development (#310) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * create the localstorage utility functions * remove uuid package * remove crypto declaration * save state in local storage * persist cart state in local storage * Display list of car items * implement remove item from cart * refactor shopping cart context component, move type definition to a new folder * Development (#312) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * create the localstorage utility functions * remove uuid package * remove crypto declaration * save state in local storage * persist cart state in local storage * Display list of car items * implement remove item from cart * refactor shopping cart context component, move type definition to a new folder * make shopping cart details child to offcanvas * Development (#315) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable the add to cart button on click none and addons * Incrementing cart quantity without addons * Fix: Add to Cart without incrementing the cart quantity throws an error * Create the summary modal and include error boundary in applocation * update error boundary url * add the edit and update button to the order summary page * add the call to action to clear cart * generate Ids for ordersummary * generate ordersummary ids * update the cart UI * create the localstorage utility functions * remove uuid package * remove crypto declaration * save state in local storage * persist cart state in local storage * Display list of car items * implement remove item from cart * refactor shopping cart context component, move type definition to a new folder * make shopping cart details child to offcanvas * create the update cart item modal * move the shopping cart component into cart folder * upgrade menu items on edit * fix build error * fix code smell * Development (#317) * update github workflow yaml file * rename the frontend folder * create the checkout button * create dynamic route * update the routing definition and getmenubyId API call * Merge branch 'development' of github.com:olasunkanmi-SE/restaurant into development * remove the styling for menu name * optimize the components * conditionally render the checkout component * remove code smell * Merge branch 'release' into development * update the menu item page and clean up the navigation * create the delete menu repo method, service and controller * create the delete menu API * update food menu component to include item id * update food menu component to include item id * add the add menu item to cart functionality * implement add menu items to cart * fix build errors * fix code smell * create the item quantity button component * update the menu list ui * implement the add items to cart functionality * fix code smell * create the selected items summary * update cart reducer * update the add item to cart implementation * create folder structure for componsnts * implement the remove from cart functionality * implement the add to cart functionality * rename add and remove from cart to add and remove menu from cart * remove the menuid from foodmenu component * create the shopping component * implement display menu quantity, also display only menu items ata a time * prevent increase in total price if the menu quantity is 1 * fix issues with totalprice calculations * fix issues with menu items reduction * fix the bug in shopping cart provider * remove menu price from global state * fix bug in remove menu from cart * fix error in menuItems calculations * update some names in the shoppingcart context * add the none button for food items * update remove item from cart method to calculate total price correctly * remove unused file * create the radio button * calculate order quantity * remove quantity count from checkout * Calculate cart total * disable add to cart buttons on page load * add development branch to github workflow, in order to track and build branches created from issues * fix code smells * enable th… * create the create order service * create order * check for duplicate orders before creating one * remove ChatGpt code reviewer * create order statuses domain entity * create the order status schema * create orser status mapper * create the order status service * resolve all dependencies * create order notes * fix build error * fix build error * fix build errors * add order notes module to app module * create the order processing queue module * update app module with OrderProcessingQueuesModule * create the get orders method * get orders (#429) Co-authored-by: Olasunkanmi Oyinlola * add notes to menui * remove notes from menu * remove notes from menu * remove notes from menu * include menuId in ordernote domain * to be fixed remotely * Development (#437) * get orders * unit test for order service * remove failing test * update create order service --------- Co-authored-by: Olasunkanmi Oyinlola * Development (#439) * get orders * unit test for order service * remove failing test * update create order service * user order status as a model not string --------- Co-authored-by: Olasunkanmi Oyinlola * Development (#442) * get orders * unit test for order service * remove failing test * update create order service * user order status as a model not string * on create order, create order notes --------- Co-authored-by: Olasunkanmi Oyinlola * create order notes through order service * update order processing queue service * on create order, create order status queue * fix issues within order statuses api * Development (#451) * get orders * unit test for order service * remove failing test * update create order service * user order status as a model not string * on create order, create order notes * add quantity available props to menu * create the delete category api --------- Co-authored-by: Olasunkanmi Oyinlola * insert order note, order queue status in db * remove unused import * fix build errors * Development (#455) * get orders * unit test for order service * remove failing test * update create order service * user order status as a model not string * on create order, create order notes * add quantity available props to menu * create the delete category api * write init test for order service * fix failing test --------- Co-authored-by: Olasunkanmi Oyinlola * implement Role based access control * fix build errors * return values from mapRoleToPriority * create the basic order response * fix error in order data model --------- Co-authored-by: Olasunkanmi Oyinlola <143487325+olasunkanmiraymond@users.noreply.github.com> Co-authored-by: Olasunkanmi Oyinlola Co-authored-by: Olasunkanmi Oyinlola --- .../interfaces/order-repository.interface.ts | 2 +- .../data_access/repositories/menu.repopsitory.ts | 2 +- .../data_access/repositories/order.repository.ts | 16 +++++++++++++--- .../repositories/schemas/cartItem.schema.ts | 2 +- .../repositories/schemas/order.schema.ts | 4 ++-- .../order/interface/order-service.interface.ts | 3 +-- backend/src/order/order.controller.ts | 7 ++++++- backend/src/order/order.parser.ts | 2 +- backend/src/order/order.service.ts | 6 ++++-- backend/src/order_notes/order_note_parser.ts | 12 ++++++++---- 10 files changed, 38 insertions(+), 18 deletions(-) diff --git a/backend/src/infrastructure/data_access/repositories/interfaces/order-repository.interface.ts b/backend/src/infrastructure/data_access/repositories/interfaces/order-repository.interface.ts index 1d6b11d5..c68ae81f 100644 --- a/backend/src/infrastructure/data_access/repositories/interfaces/order-repository.interface.ts +++ b/backend/src/infrastructure/data_access/repositories/interfaces/order-repository.interface.ts @@ -1,11 +1,11 @@ import { Order } from 'src/order/order'; import { OrderDataModel, OrderDocument } from '../schemas/order.schema'; import { IGenericDocument } from 'src/infrastructure/database'; -import { CartItemDataModel } from '../schemas/cartItem.schema'; import { Result } from 'src/domain'; import { CreateCartItemsDTO } from 'src/order/dto/create-order.dto'; export interface IOrderRepository extends IGenericDocument { createOrder(order: OrderDataModel): Promise>; getDuplicateOrder(type: string, merchantId: string, cartItems: CreateCartItemsDTO[]): Promise; + getOrders(): Promise>; } diff --git a/backend/src/infrastructure/data_access/repositories/menu.repopsitory.ts b/backend/src/infrastructure/data_access/repositories/menu.repopsitory.ts index 60f89592..4a5a79c7 100644 --- a/backend/src/infrastructure/data_access/repositories/menu.repopsitory.ts +++ b/backend/src/infrastructure/data_access/repositories/menu.repopsitory.ts @@ -60,7 +60,7 @@ export class MenuRepository extends GenericDocumentRepository> { - const document = await this.DocumentModel.findById(id).populate('itemDetails').populate('category').exec(); + const document = await this.DocumentModel.findById(id).populate('items').populate('category').exec(); const menu: Menu = this.menuMapper.toDomain(document); if (!document) { return Result.fail('Error getting menu from database', HttpStatus.NOT_FOUND); diff --git a/backend/src/infrastructure/data_access/repositories/order.repository.ts b/backend/src/infrastructure/data_access/repositories/order.repository.ts index e9c85e63..25f7e398 100644 --- a/backend/src/infrastructure/data_access/repositories/order.repository.ts +++ b/backend/src/infrastructure/data_access/repositories/order.repository.ts @@ -1,14 +1,13 @@ import { HttpStatus, Injectable } from '@nestjs/common'; import { InjectConnection, InjectModel } from '@nestjs/mongoose'; import { Connection, Model } from 'mongoose'; +import { Result } from 'src/domain'; import { GenericDocumentRepository } from 'src/infrastructure/database'; +import { CreateCartItemsDTO } from 'src/order/dto/create-order.dto'; import { Order } from 'src/order/order'; import { OrderMapper } from './../../../order/order.mapper'; import { IOrderRepository } from './interfaces/order-repository.interface'; import { OrderDataModel, OrderDocument } from './schemas/order.schema'; -import { Result } from 'src/domain'; -import { CartItemDataModel } from './schemas/cartItem.schema'; -import { CreateCartItemsDTO } from 'src/order/dto/create-order.dto'; @Injectable() export class OrderRepository extends GenericDocumentRepository implements IOrderRepository { @@ -46,4 +45,15 @@ export class OrderRepository extends GenericDocumentRepository 0; } + + async getOrders(): Promise> { + const documents = await this.DocumentModel.find({ _id: '655e104ec80addfb375334ec' }) + .populate('state') + .populate('cartItems') + .exec(); + if (documents) { + const orders: Order[] = documents.map((document) => this.orderMapper.toDomain(document)); + return orders?.length > 0 ? Result.ok(orders) : Result.fail('No orders found', HttpStatus.NOT_FOUND); + } + } } diff --git a/backend/src/infrastructure/data_access/repositories/schemas/cartItem.schema.ts b/backend/src/infrastructure/data_access/repositories/schemas/cartItem.schema.ts index 053976f4..c0045da5 100644 --- a/backend/src/infrastructure/data_access/repositories/schemas/cartItem.schema.ts +++ b/backend/src/infrastructure/data_access/repositories/schemas/cartItem.schema.ts @@ -8,7 +8,7 @@ import { OrderDataModel } from './order.schema'; import { SelectedCartItemDataModel } from './selected-cart-item.schema'; export type CartItemDocument = CartItemDataModel & Document; -@Schema({ versionKey: 'false' }) +@Schema({ versionKey: false }) export class CartItemDataModel extends BaseDocument implements ICartItemModel { @Prop({ type: mongoose.Schema.Types.ObjectId }) @Type(() => MenuDataModel) diff --git a/backend/src/infrastructure/data_access/repositories/schemas/order.schema.ts b/backend/src/infrastructure/data_access/repositories/schemas/order.schema.ts index f07f3723..b0ee6ceb 100644 --- a/backend/src/infrastructure/data_access/repositories/schemas/order.schema.ts +++ b/backend/src/infrastructure/data_access/repositories/schemas/order.schema.ts @@ -30,11 +30,11 @@ export class OrderDataModel extends BaseDocument implements IOrderDataModel { @Prop({ type: Number, required: true }) total: number; - @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: () => CartItemDataModel }] }) + @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'CartItemDataModel' }] }) @Type(() => CartItemDataModel) cartItems?: CartItemDataModel[]; - @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: () => OrderStatusModel }] }) + @Prop({ type: { type: mongoose.Schema.Types.ObjectId, ref: OrderStatusModel.name } }) @Type(() => OrderStatusModel) state: OrderStatusModel; } diff --git a/backend/src/order/interface/order-service.interface.ts b/backend/src/order/interface/order-service.interface.ts index 88cf0c16..5c494f2d 100644 --- a/backend/src/order/interface/order-service.interface.ts +++ b/backend/src/order/interface/order-service.interface.ts @@ -1,9 +1,8 @@ import { Result } from 'src/domain'; import { CreateOrderDTO } from '../dto/create-order.dto'; -import { Order } from '../order'; import { IOrderResponseDTO } from '../order-response.dto'; export interface IOrderService { createOrder(orderSummary: CreateOrderDTO): Promise>; - getOrders(): Promise>; + getOrdersBasic(): Promise; } diff --git a/backend/src/order/order.controller.ts b/backend/src/order/order.controller.ts index 2b5fade1..79b3024e 100644 --- a/backend/src/order/order.controller.ts +++ b/backend/src/order/order.controller.ts @@ -1,5 +1,5 @@ import { IOrderResponseDTO } from './order-response.dto'; -import { Body, Controller, Inject, Post } from '@nestjs/common'; +import { Body, Controller, Get, Inject, Post } from '@nestjs/common'; import { TYPES } from 'src/application'; import { IOrderService } from './interface/order-service.interface'; import { CreateOrderDTO } from './dto/create-order.dto'; @@ -13,4 +13,9 @@ export class OrderController { async create(@Body() request: CreateOrderDTO): Promise> { return this.orderService.createOrder(request); } + + @Get('') + async get(): Promise { + return this.orderService.getOrdersBasic(); + } } diff --git a/backend/src/order/order.parser.ts b/backend/src/order/order.parser.ts index 4a65b0d5..8e5da8b1 100644 --- a/backend/src/order/order.parser.ts +++ b/backend/src/order/order.parser.ts @@ -17,7 +17,7 @@ export class OrderParser { total, discount, orderManagerId, - notes: OrderNoteParser.createOrderNotesResponse(notes), + notes: OrderNoteParser.createOrderNotesResponse(notes) || [], ...AuditParser.createAuditResponse(audit), }; } diff --git a/backend/src/order/order.service.ts b/backend/src/order/order.service.ts index f27d4f2a..e62fd63a 100644 --- a/backend/src/order/order.service.ts +++ b/backend/src/order/order.service.ts @@ -146,8 +146,10 @@ export class OrderService implements IOrderService { } } - async getOrders(): Promise> { - return await this.orderRepository.find({}); + async getOrdersBasic(): Promise { + const result = await this.orderRepository.getOrders(); + const response = OrderParser.createOrdersResponse(result.getValue()); + return response; } async createOrderNotes(cartItems: CreateCartItemsDTO[], orderId: Types.ObjectId): Promise { diff --git a/backend/src/order_notes/order_note_parser.ts b/backend/src/order_notes/order_note_parser.ts index c97b788a..685c7519 100644 --- a/backend/src/order_notes/order_note_parser.ts +++ b/backend/src/order_notes/order_note_parser.ts @@ -7,9 +7,13 @@ export class OrderNoteParser { return { id, note, orderId, ...AuditParser.createAuditResponse(audit) }; } - static createOrderNotesResponse(orderNote: OrderNote[]): IOrderNoteResponseDTO[] { - return orderNote.map((note) => { - return this.createResponse(note); - }); + static createOrderNotesResponse(orderNotes: OrderNote[]): IOrderNoteResponseDTO[] { + let notes: IOrderNoteResponseDTO[] = []; + if (orderNotes?.length) { + notes = orderNotes.map((note) => { + return this.createResponse(note); + }); + } + return notes; } }