product functionality added
This commit is contained in:
parent
fe7c3f8dd9
commit
0f2200fd25
@ -25,8 +25,7 @@ export const createBlog = async (req, res) => {
|
|||||||
// Create the blog post
|
// Create the blog post
|
||||||
const blog = await Blog.create({
|
const blog = await Blog.create({
|
||||||
title,
|
title,
|
||||||
tags: tags.split(/\s*,\s*|\s+/)
|
tags: tags.split(/\s*,\s*|\s+/).filter((tag) => tag.trim() !== ""), // Splitting tags string into array
|
||||||
.filter(tag => tag.trim() !== ''), // Splitting tags string into array
|
|
||||||
image,
|
image,
|
||||||
blog_content,
|
blog_content,
|
||||||
});
|
});
|
||||||
@ -104,7 +103,7 @@ export const deleteImageFromCloudinary = async (req, res) => {
|
|||||||
if (response) {
|
if (response) {
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
msg: "Blog Deleted Successfully!!",
|
msg: "Image Deleted Successfully!!",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -161,8 +160,7 @@ export const updateBlog = async (req, res) => {
|
|||||||
// Prepare an object for the updated testimonial data
|
// Prepare an object for the updated testimonial data
|
||||||
const updatedBlogData = {
|
const updatedBlogData = {
|
||||||
title,
|
title,
|
||||||
tags: tags.split(/\s*,\s*|\s+/)
|
tags: tags.split(/\s*,\s*|\s+/).filter((tag) => tag.trim() !== ""), // Splitting tags string into array
|
||||||
.filter(tag => tag.trim() !== ''), // Splitting tags string into array
|
|
||||||
blog_content,
|
blog_content,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,13 +22,7 @@ router
|
|||||||
authorizeRoles("admin", "Employee"),
|
authorizeRoles("admin", "Employee"),
|
||||||
deletecarrency
|
deletecarrency
|
||||||
);
|
);
|
||||||
// router
|
|
||||||
// .route("/deleteImage/jatinMor/Blog/:public_id")
|
|
||||||
// .delete(
|
|
||||||
// isAuthenticatedUser,
|
|
||||||
// authorizeRoles("admin", "Employee"),
|
|
||||||
// deleteImageFromCloudinary
|
|
||||||
// );
|
|
||||||
router
|
router
|
||||||
.route("/:id")
|
.route("/:id")
|
||||||
.patch(
|
.patch(
|
||||||
|
Loading…
Reference in New Issue
Block a user