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("/resetpassword/*", renderer.displayPassReset);
  14. //Merchant
  15. app.post("/merchant/create/none", merchantData.createMerchantNone);
  16. app.get("/merchant/create/clover", merchantData.createMerchantClover);
  17. app.get("/merchant/create/square", merchantData.createMerchantSquare);
  18. app.put("/merchant/ingredients/update/:id/:unit", merchantData.ingredientDefaultUnit);
  19. app.put("/merchant/ingredients/update", merchantData.updateMerchantIngredient); //also updates some data in ingredients
  20. app.post("/merchant/password", merchantData.updatePassword);
  21. //Ingredients
  22. app.get("/ingredients", ingredientData.getIngredients);
  23. app.post("/ingredients/create", ingredientData.createIngredient); //also adds to merchant
  24. app.put("/ingredients/update", ingredientData.updateIngredient);
  25. app.delete("/ingredients/remove/:id", ingredientData.removeIngredient);
  26. //Recipes
  27. app.post("/recipe/create", recipeData.createRecipe);
  28. app.put("/recipe/update", recipeData.updateRecipe);
  29. app.delete("/recipe/remove/:id", recipeData.removeRecipe);
  30. app.get("/recipe/update/clover", recipeData.updateRecipesClover);
  31. app.get("/recipe/update/square", recipeData.updateRecipesSquare);
  32. //Orders
  33. app.get("/order", orderData.getOrders);
  34. app.post("/order", orderData.orderFilter);
  35. app.post("/order/create", orderData.createOrder);
  36. app.delete("/order/:id", orderData.removeOrder);
  37. //Transactions
  38. app.post("/transaction", transactionData.getTransactions);
  39. app.post("/transaction/create", transactionData.createTransaction);
  40. app.delete("/transaction/:id", transactionData.remove);
  41. app.post("/transaction/retrieve", transactionData.getTransactionsByDate);
  42. app.get("/populatesometransactions", transactionData.populate);
  43. //Other
  44. app.post("/login", otherData.login);
  45. app.get("/logout", otherData.logout);
  46. app.get("/cloverlogin", otherData.cloverRedirect);
  47. app.get("/squarelogin", otherData.squareRedirect);
  48. app.get("/cloverauth*", otherData.cloverAuth);
  49. app.get("/squareauth", otherData.squareAuth);
  50. app.get("/logo", otherData.logo);
  51. //Information Pages
  52. app.get("/privacy", informationPages.privacy);
  53. app.get("/terms", informationPages.terms);
  54. app.get("/help", informationPages.help);
  55. }