routes.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. const emailVerification = require("./controllers/emailVerification.js");
  10. const passwordReset = require("./controllers/passwordReset.js");
  11. module.exports = function(app){
  12. //Render page
  13. app.get("/", renderer.landingPage);
  14. app.get("/dashboard", renderer.displayDashboard);
  15. app.get("/resetpassword/*", renderer.displayPassReset);
  16. //Merchant
  17. app.post("/merchant/create/none", merchantData.createMerchantNone);
  18. app.get("/merchant/create/clover", merchantData.createMerchantClover);
  19. app.get("/merchant/create/square", merchantData.createMerchantSquare);
  20. app.put("/merchant/ingredients/update/:id/:unit", merchantData.ingredientDefaultUnit);
  21. app.put("/merchant/ingredients/update", merchantData.updateMerchantIngredient); //also updates some data in ingredients
  22. app.post("/merchant/password", merchantData.updatePassword);
  23. //Ingredients
  24. app.get("/ingredients", ingredientData.getIngredients);
  25. app.post("/ingredients/create", ingredientData.createIngredient); //also adds to merchant
  26. app.put("/ingredients/update", ingredientData.updateIngredient);
  27. app.delete("/ingredients/remove/:id", ingredientData.removeIngredient);
  28. //Recipes
  29. app.post("/recipe/create", recipeData.createRecipe);
  30. app.put("/recipe/update", recipeData.updateRecipe);
  31. app.delete("/recipe/remove/:id", recipeData.removeRecipe);
  32. app.get("/recipe/update/clover", recipeData.updateRecipesClover);
  33. app.get("/recipe/update/square", recipeData.updateRecipesSquare);
  34. //Orders
  35. app.get("/order", orderData.getOrders);
  36. app.post("/order", orderData.orderFilter);
  37. app.post("/order/create", orderData.createOrder);
  38. app.delete("/order/:id", orderData.removeOrder);
  39. //Transactions
  40. app.post("/transaction", transactionData.getTransactions);
  41. app.post("/transaction/create", transactionData.createTransaction);
  42. app.delete("/transaction/:id", transactionData.remove);
  43. app.post("/transaction/retrieve", transactionData.getTransactionsByDate);
  44. app.get("/populatesometransactions", transactionData.populate);
  45. //Other
  46. app.post("/login", otherData.login);
  47. app.get("/logout", otherData.logout);
  48. app.get("/cloverlogin", otherData.cloverRedirect);
  49. app.get("/squarelogin", otherData.squareRedirect);
  50. app.get("/cloverauth*", otherData.cloverAuth);
  51. app.get("/squareauth", otherData.squareAuth);
  52. app.get("/logo", otherData.logo);
  53. //Information Pages
  54. app.get("/privacy", informationPages.privacy);
  55. app.get("/terms", informationPages.terms);
  56. app.get("/help", informationPages.help);
  57. //Email verification
  58. app.get("/verify/email/:id", emailVerification.sendVerifyEmail);
  59. app.get("/verify/:id", emailVerification.verifyPage);
  60. app.post("/verify", emailVerification.verify);
  61. //Password reset
  62. app.get("/reset/email", passwordReset.enterEmail);
  63. }