routes.js 3.6 KB

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