api/resources/ShippingAddressesRD/RDShippingAddressRoute.js

44 lines
1.2 KiB
JavaScript

import express from "express";
import {
AddshippingAddress,
getSingleUserSippingAddress,
deleteSelfShippingAddress,
getSingleUserSippingAddressForAdmin,
updateShippingAddress,
getSingleSippingAddress,
AddshippingAddressByAdmin,
} from "./RDShippingAddressController.js";
import { authorizeRoles, isAuthenticatedUser } from "../../middlewares/auth.js";
import { isAuthenticatedRD } from "../../middlewares/rdAuth.js";
const router = express.Router();
router.route("/new").post(isAuthenticatedRD, AddshippingAddress);
router
.route("/admin/new/:_id")
.post(
isAuthenticatedUser,
authorizeRoles("admin"),
AddshippingAddressByAdmin
);
router
.route("/user/address/")
.get(isAuthenticatedUser, getSingleUserSippingAddress);
router.route("/").get(isAuthenticatedRD, getSingleUserSippingAddress);
router
.route("/user/address/:_id")
.get(
isAuthenticatedUser,
authorizeRoles("admin"),
getSingleUserSippingAddressForAdmin
);
router
.route("/delete/:id")
.delete(isAuthenticatedUser, deleteSelfShippingAddress);
router.route("/update/:id").patch(isAuthenticatedUser, updateShippingAddress);
router.route("/get/:id").get(isAuthenticatedUser, getSingleSippingAddress);
export default router;