From 57a901dadf02ab3c79d15b2010f35207348f7e52 Mon Sep 17 00:00:00 2001 From: Oyinlola Olasunkanmi Raymond <60177090+olasunkanmi-SE@users.noreply.github.com> Date: Tue, 14 Nov 2023 22:56:37 +0800 Subject: [PATCH] Development (#417) 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 --------- Co-authored-by: Olasunkanmi Oyinlola <143487325+olasunkanmiraymond@users.noreply.github.com> Co-authored-by: Olasunkanmi Oyinlola --- backend/src/application/constants/types.ts | 1 + .../interfaces/order-status.repository.ts | 8 +++ .../repositories/order-status.repository.ts | 25 ++++++-- .../schemas/order-status.schema.ts | 7 +-- .../dto/create-order_status.dto.ts | 11 +++- .../dto/order-status-response.ts | 10 +++ .../order-status-service.interface.ts | 9 +++ .../src/order_statuses/order_status.entity.ts | 63 ------------------- .../src/order_statuses/order_status.mapper.ts | 2 +- .../src/order_statuses/order_status_parser.ts | 15 +++++ .../order_statuses.controller.spec.ts | 20 ------ .../order_statuses.controller.ts | 24 ++----- .../order_statuses.service.spec.ts | 18 ------ .../order_statuses/order_statuses.service.ts | 44 +++++++------ 14 files changed, 107 insertions(+), 150 deletions(-) create mode 100644 backend/src/infrastructure/data_access/repositories/interfaces/order-status.repository.ts create mode 100644 backend/src/order_statuses/dto/order-status-response.ts create mode 100644 backend/src/order_statuses/interface/order-status-service.interface.ts delete mode 100644 backend/src/order_statuses/order_status.entity.ts create mode 100644 backend/src/order_statuses/order_status_parser.ts delete mode 100644 backend/src/order_statuses/order_statuses.controller.spec.ts delete mode 100644 backend/src/order_statuses/order_statuses.service.spec.ts diff --git a/backend/src/application/constants/types.ts b/backend/src/application/constants/types.ts index 7105f07e..c826577b 100644 --- a/backend/src/application/constants/types.ts +++ b/backend/src/application/constants/types.ts @@ -23,4 +23,5 @@ export const TYPES = { IOrderRepository: Symbol('IOrderRepository'), IOrderService: Symbol('IOrderService'), ICartItemRepository: Symbol('ICartItemRepository'), + IOrderStatusRepository: Symbol('IOrderStatusRepository'), }; diff --git a/backend/src/infrastructure/data_access/repositories/interfaces/order-status.repository.ts b/backend/src/infrastructure/data_access/repositories/interfaces/order-status.repository.ts new file mode 100644 index 00000000..ad012af5 --- /dev/null +++ b/backend/src/infrastructure/data_access/repositories/interfaces/order-status.repository.ts @@ -0,0 +1,8 @@ +import { OrderStatusModel } from 'src/infrastructure/data_access/repositories/schemas/order-status.schema'; +import { Result } from 'src/domain'; +import { IGenericDocument } from 'src/infrastructure/database'; +import { OrderStatus } from 'src/order_statuses/order_status'; + +export interface IOrderStatusRespository extends IGenericDocument { + createOrderStatus(status: OrderStatus): Promise>; +} diff --git a/backend/src/infrastructure/data_access/repositories/order-status.repository.ts b/backend/src/infrastructure/data_access/repositories/order-status.repository.ts index 859bb03f..8d7d1a79 100644 --- a/backend/src/infrastructure/data_access/repositories/order-status.repository.ts +++ b/backend/src/infrastructure/data_access/repositories/order-status.repository.ts @@ -1,20 +1,35 @@ -import { Injectable } from '@nestjs/common'; +import { HttpStatus, Injectable } from '@nestjs/common'; import { OrderStatusDocument, OrderStatusModel } from './schemas/order-status.schema'; import { OrderStatus } from 'src/order_statuses/order_status'; import { GenericDocumentRepository } from 'src/infrastructure/database'; import { InjectConnection, InjectModel } from '@nestjs/mongoose'; import { Connection, Model } from 'mongoose'; -import { orderStatusMapper } from 'src/order_statuses/order_status.mapper'; +import { OrderStatusMapper } from 'src/order_statuses/order_status.mapper'; +import { Result } from 'src/domain'; +import { IOrderStatusRespository } from './interfaces/order-status.repository'; +import { throwApplicationError } from 'src/infrastructure/utilities/exception-instance'; @Injectable() -export class OrderStatusRepository extends GenericDocumentRepository { - orderStatusMapper: orderStatusMapper; +export class OrderStatusRepository + extends GenericDocumentRepository + implements IOrderStatusRespository +{ + orderStatusMapper: OrderStatusMapper; constructor( @InjectModel(OrderStatusModel.name) orderStatusDataModel: Model, @InjectConnection() readonly connection: Connection, - orderStatusMapper: orderStatusMapper, + orderStatusMapper: OrderStatusMapper, ) { super(orderStatusDataModel, connection, orderStatusMapper); this.orderStatusMapper = orderStatusMapper; } + + async createOrderStatus(status: OrderStatus): Promise> { + const orderStatusToSave = this.orderStatusMapper.toPersistence(status); + const result = (await this.create(orderStatusToSave)).getValue(); + if (!result) { + throwApplicationError(HttpStatus.INTERNAL_SERVER_ERROR, `Error while creating order status`); + } + return Result.ok(result); + } } diff --git a/backend/src/infrastructure/data_access/repositories/schemas/order-status.schema.ts b/backend/src/infrastructure/data_access/repositories/schemas/order-status.schema.ts index fad40512..e7df93a0 100644 --- a/backend/src/infrastructure/data_access/repositories/schemas/order-status.schema.ts +++ b/backend/src/infrastructure/data_access/repositories/schemas/order-status.schema.ts @@ -1,10 +1,9 @@ import { BaseDocument } from 'src/infrastructure/database'; import { IOrderStatusModel } from '../models/order-status-model.interface'; import { Prop } from '@nestjs/mongoose'; -import mongoose from 'mongoose'; +import mongoose, { Document } from 'mongoose'; import { OrderDataModel } from './order.schema'; import { Type } from 'class-transformer'; -import { Document } from 'mongoose'; export type OrderStatusDocument = OrderStatusModel & Document; export class OrderStatusModel extends BaseDocument implements IOrderStatusModel { @@ -17,8 +16,8 @@ export class OrderStatusModel extends BaseDocument implements IOrderStatusModel @Prop({ type: String, required: true }) name: string; - @Prop({ type: String, required: true }) - description: string; + @Prop({ type: String, required: true, isRequired: false }) + description?: string; @Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: OrderDataModel }] }) @Type(() => OrderDataModel) diff --git a/backend/src/order_statuses/dto/create-order_status.dto.ts b/backend/src/order_statuses/dto/create-order_status.dto.ts index 567c69e5..d75f76eb 100644 --- a/backend/src/order_statuses/dto/create-order_status.dto.ts +++ b/backend/src/order_statuses/dto/create-order_status.dto.ts @@ -1 +1,10 @@ -export class CreateOrderStatusDto {} +import { IsNotEmpty, IsString } from 'class-validator'; + +export class CreateOrderStatusDto { + @IsString() + @IsNotEmpty() + isActive: boolean; + name: string; + code: string; + description?: string; +} diff --git a/backend/src/order_statuses/dto/order-status-response.ts b/backend/src/order_statuses/dto/order-status-response.ts new file mode 100644 index 00000000..dca97382 --- /dev/null +++ b/backend/src/order_statuses/dto/order-status-response.ts @@ -0,0 +1,10 @@ +import { Types } from 'mongoose'; +import { IAudit } from 'src/infrastructure'; + +export interface IOrderStatusResponseDTO extends IAudit { + id: Types.ObjectId; + name: string; + code: string; + description?: string; + isActive: boolean; +} diff --git a/backend/src/order_statuses/interface/order-status-service.interface.ts b/backend/src/order_statuses/interface/order-status-service.interface.ts new file mode 100644 index 00000000..8a42d59c --- /dev/null +++ b/backend/src/order_statuses/interface/order-status-service.interface.ts @@ -0,0 +1,9 @@ +import { Result } from 'src/domain'; +import { CreateOrderStatusDto } from '../dto/create-order_status.dto'; +import { OrderStatus } from '../order_status'; +import { IOrderStatusResponseDTO } from '../dto/order-status-response'; + +export interface IOrderStatusService { + createOrderStatus(props: CreateOrderStatusDto): Promise>; + getOrderStatuses(): Promise>; +} diff --git a/backend/src/order_statuses/order_status.entity.ts b/backend/src/order_statuses/order_status.entity.ts deleted file mode 100644 index b7b8501d..00000000 --- a/backend/src/order_statuses/order_status.entity.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Audit, Entity, Result } from 'src/domain'; -import { IOrderStatuses } from './order_status_entity.interface'; -import { Types } from 'mongoose'; - -export class OrderStatus extends Entity implements IOrderStatuses { - _isActive: boolean; - _name: string; - _code: string; - _description?: string; - _audit: Audit; - constructor(id: Types.ObjectId, props: IOrderStatuses) { - super(id); - this._isActive = props.isActive; - this._name = props.name; - this._code = props.code; - this._description = props.description; - this._audit = props.audit; - } - - get isActive(): boolean { - return this._isActive; - } - - set isActive(isActive: boolean) { - this._isActive = isActive; - } - - get name(): string { - return this._name; - } - - set name(name: string) { - this._name = name; - } - - get code(): string { - return this._code; - } - - set code(code: string) { - this._code = code; - } - - get description(): string { - return this._description; - } - - set description(description: string) { - this._description = description; - } - - get audit(): Audit { - return this._audit; - } - - set audit(audit: Audit) { - this._audit = audit; - } - - static create(props: IOrderStatuses, id?: Types.ObjectId) { - return Result.ok(new OrderStatus(id, props)).getValue(); - } -} diff --git a/backend/src/order_statuses/order_status.mapper.ts b/backend/src/order_statuses/order_status.mapper.ts index 661f6639..3528b583 100644 --- a/backend/src/order_statuses/order_status.mapper.ts +++ b/backend/src/order_statuses/order_status.mapper.ts @@ -5,7 +5,7 @@ import { OrderStatusModel } from 'src/infrastructure/data_access/repositories/sc import { AuditMapper } from 'src/audit'; @Injectable() -export class orderStatusMapper implements IMapper { +export class OrderStatusMapper implements IMapper { constructor(private readonly auditMapper: AuditMapper) {} toPersistence(entity: OrderStatus): OrderStatusModel { const { id, isActive, name, code, description, audit } = entity; diff --git a/backend/src/order_statuses/order_status_parser.ts b/backend/src/order_statuses/order_status_parser.ts new file mode 100644 index 00000000..3abbc870 --- /dev/null +++ b/backend/src/order_statuses/order_status_parser.ts @@ -0,0 +1,15 @@ +import { AuditParser } from './../audit/audit.parser'; +import { IOrderStatusResponseDTO } from './dto/order-status-response'; +import { OrderStatus } from './order_status'; + +export class OrderStatusParser { + static createResponse({ id, name, isActive, description, code, audit }: OrderStatus): IOrderStatusResponseDTO { + return { id, name, code, description, isActive, ...AuditParser.createAuditResponse(audit) }; + } + + static createOrderStatusResponses(orderStatus: OrderStatus[]) { + return orderStatus.map((status) => { + this.createResponse(status); + }); + } +} diff --git a/backend/src/order_statuses/order_statuses.controller.spec.ts b/backend/src/order_statuses/order_statuses.controller.spec.ts deleted file mode 100644 index fadddd60..00000000 --- a/backend/src/order_statuses/order_statuses.controller.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OrderStatusesController } from './order_statuses.controller'; -import { OrderStatusesService } from './order_statuses.service'; - -describe('OrderStatusesController', () => { - let controller: OrderStatusesController; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [OrderStatusesController], - providers: [OrderStatusesService], - }).compile(); - - controller = module.get(OrderStatusesController); - }); - - it('should be defined', () => { - expect(controller).toBeDefined(); - }); -}); diff --git a/backend/src/order_statuses/order_statuses.controller.ts b/backend/src/order_statuses/order_statuses.controller.ts index 6055cc39..5486afa7 100644 --- a/backend/src/order_statuses/order_statuses.controller.ts +++ b/backend/src/order_statuses/order_statuses.controller.ts @@ -1,7 +1,6 @@ -import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; -import { OrderStatusesService } from './order_statuses.service'; +import { Body, Controller, Get, Post } from '@nestjs/common'; import { CreateOrderStatusDto } from './dto/create-order_status.dto'; -import { UpdateOrderStatusDto } from './dto/update-order_status.dto'; +import { OrderStatusesService } from './order_statuses.service'; @Controller('order-statuses') export class OrderStatusesController { @@ -9,26 +8,11 @@ export class OrderStatusesController { @Post() create(@Body() createOrderStatusDto: CreateOrderStatusDto) { - return this.orderStatusesService.create(createOrderStatusDto); + return this.orderStatusesService.createOrderStatus(createOrderStatusDto); } @Get() findAll() { - return this.orderStatusesService.findAll(); - } - - @Get(':id') - findOne(@Param('id') id: string) { - return this.orderStatusesService.findOne(+id); - } - - @Patch(':id') - update(@Param('id') id: string, @Body() updateOrderStatusDto: UpdateOrderStatusDto) { - return this.orderStatusesService.update(+id, updateOrderStatusDto); - } - - @Delete(':id') - remove(@Param('id') id: string) { - return this.orderStatusesService.remove(+id); + return this.orderStatusesService.getOrderStatuses(); } } diff --git a/backend/src/order_statuses/order_statuses.service.spec.ts b/backend/src/order_statuses/order_statuses.service.spec.ts deleted file mode 100644 index 9542e1fd..00000000 --- a/backend/src/order_statuses/order_statuses.service.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OrderStatusesService } from './order_statuses.service'; - -describe('OrderStatusesService', () => { - let service: OrderStatusesService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [OrderStatusesService], - }).compile(); - - service = module.get(OrderStatusesService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); diff --git a/backend/src/order_statuses/order_statuses.service.ts b/backend/src/order_statuses/order_statuses.service.ts index 13ebb77c..2c983fcd 100644 --- a/backend/src/order_statuses/order_statuses.service.ts +++ b/backend/src/order_statuses/order_statuses.service.ts @@ -1,26 +1,34 @@ -import { Injectable } from '@nestjs/common'; +import { Inject, Injectable } from '@nestjs/common'; +import { TYPES } from 'src/application'; +import { Audit, Result } from 'src/domain'; +import { Context, IContextService } from 'src/infrastructure'; +import { IOrderStatusRespository } from 'src/infrastructure/data_access/repositories/interfaces/order-status.repository'; import { CreateOrderStatusDto } from './dto/create-order_status.dto'; -import { UpdateOrderStatusDto } from './dto/update-order_status.dto'; +import { IOrderStatusResponseDTO } from './dto/order-status-response'; +import { IOrderStatusService } from './interface/order-status-service.interface'; +import { OrderStatus } from './order_status'; +import { OrderStatusParser } from './order_status_parser'; @Injectable() -export class OrderStatusesService { - create(createOrderStatusDto: CreateOrderStatusDto) { - return 'This action adds a new orderStatus'; +export class OrderStatusesService implements IOrderStatusService { + private context: Context; + constructor( + @Inject(TYPES.IOrderStatusRepository) private readonly orderStatusRepository: IOrderStatusRespository, + @Inject(TYPES.IContextService) + private readonly contextService: IContextService, + ) { + this.context = this.contextService.getContext(); } - - findAll() { - return `This action returns all orderStatuses`; - } - - findOne(id: number) { - return `This action returns a #${id} orderStatus`; - } - - update(id: number, updateOrderStatusDto: UpdateOrderStatusDto) { - return `This action updates a #${id} orderStatus`; + async createOrderStatus(props: CreateOrderStatusDto): Promise> { + const audit: Audit = Audit.createInsertContext(this.context); + const orderStatusEntity = OrderStatus.create({ ...props, audit }); + const result = await this.orderStatusRepository.createOrderStatus(orderStatusEntity); + const orderStatus = result.getValue(); + const response: IOrderStatusResponseDTO = OrderStatusParser.createResponse(orderStatus); + return Result.ok(response); } - remove(id: number) { - return `This action removes a #${id} orderStatus`; + getOrderStatuses(): Promise> { + return this.orderStatusRepository.find({}); } }