added route to get business details

This commit is contained in:
MD ARIF KHAN 2023-04-07 17:02:27 +05:30
parent 68fb80f96d
commit dc7dbeeddc
2 changed files with 13 additions and 0 deletions

View File

@ -157,6 +157,17 @@ export const getAllBusiness = async (req, res) => {
});
}
};
//6.Get User Detail
export const getBusinessDetails = catchAsyncErrors(async (req, res, next) => {
const user = await Business.findById(req.business.id);
res.status(200).json({
success: true,
user,
});
});
export const getSingleBusiness = async (req, res) => {
try {
if (!req?.user) return res.status(400).json({ message: "please login !" });

View File

@ -14,10 +14,12 @@ import {
getSelfBusiness,
loginBusiness,
forgotPassword,
getBusinessDetails,
} from "./BusinessController.js";
const router = Router();
router.route("/details").get(isBusinessAuthenticated, getBusinessDetails);
router
.route("/add")
.post(isAuthenticatedUser, authorizeRoles("admin"), createBusiness);