const router = require("express").Router();
const upload = require("../middleware/uploads");
const verifyToken = require("../middleware/verifyToken");
const verifyAccess = require("../middleware/verifyAccess");
const {
  uploadFile,
  getFileByPath,
  deleteFileByPath,
} = require("../controllers/file_uploads.controller");

router.post("/", verifyToken.verifyAccessToken, verifyAccess(), upload.single("file"), uploadFile);

router.route("/:folder/:filename")
  .get(verifyToken.verifyAccessToken, getFileByPath)
  .delete(verifyToken.verifyAccessToken, verifyAccess(), deleteFileByPath);

module.exports = router;