routes.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const renderer = require("./controllers/renderer");
  2. const merchantData = require("./controllers/merchantData");
  3. const ingredientData = require("./controllers/ingredientData");
  4. const otherData = require("./controllers/otherData");
  5. const transactionData = require("./controllers/transactionData");
  6. const recipeData = require("./controllers/recipeData");
  7. const orderData = require("./controllers/orderData.js");
  8. const informationPages = require("./controllers/informationPages.js");
  9. module.exports = function(app){
  10. //Render page
  11. app.get("/", renderer.landingPage);
  12. app.get("/dashboard", renderer.displayDashboard);
  13. app.get("/information", renderer.displayLegal);
  14. app.get("/resetpassword/*", renderer.displayPassReset);
  15. //Merchant
  16. app.post("/merchant/create/none", merchantData.createMerchantNone);
  17. app.get("/merchant/create/clover", merchantData.createMerchantClover);
  18. app.get("/merchant/create/square", merchantData.createMerchantSquare);
  19. app.delete("/merchant/recipes/remove/:id", merchantData.removeRecipe);
  20. app.delete("/merchant/ingredients/remove/:id", merchantData.removeMerchantIngredient);
  21. app.put("/merchant/ingredients/update/:id/:unit", merchantData.ingredientDefaultUnit);
  22. app.put("/merchant/ingredients/update", merchantData.updateMerchantIngredient); //also updates some data in ingredients
  23. app.post("/merchant/password", merchantData.updatePassword);
  24. //Ingredients
  25. app.get("/ingredients", ingredientData.getIngredients);
  26. app.post("/ingredients/create", ingredientData.createIngredient); //also adds to merchant
  27. app.put("/ingredients/update", ingredientData.updateIngredient);
  28. //Recipes
  29. app.post("/recipe/create", recipeData.createRecipe);
  30. app.put("/recipe/update", recipeData.updateRecipe);
  31. app.get("/recipe/update/clover", recipeData.updateRecipesClover);
  32. app.get("/recipe/update/square", recipeData.updateRecipesSquare);
  33. //Orders
  34. app.get("/order", orderData.getOrders);
  35. app.post("/order", orderData.orderFilter);
  36. app.post("/order/create", orderData.createOrder);
  37. app.delete("/order/:id", orderData.removeOrder);
  38. //Transactions
  39. app.post("/transaction", transactionData.getTransactions);
  40. app.post("/transaction/create", transactionData.createTransaction);
  41. app.delete("/transaction/:id", transactionData.remove);
  42. app.post("/transaction/retrieve", transactionData.getTransactionsByDate);
  43. app.get("/populatesometransactions", transactionData.populate);
  44. //Other
  45. app.post("/login", otherData.login);
  46. app.get("/logout", otherData.logout);
  47. app.get("/cloverlogin", otherData.cloverRedirect);
  48. app.get("/squarelogin", otherData.squareRedirect);
  49. app.get("/cloverauth*", otherData.cloverAuth);
  50. app.get("/squareauth", otherData.squareAuth);
  51. //Information Pages
  52. app.get("/privacy", informationPages.privacy);
  53. app.get("/terms", informationPages.terms);
  54. app.get("/help", informationPages.help);
  55. }