make it betterslsf

This commit is contained in:
pawan-dot 2022-06-13 17:06:47 +05:30
parent 4a930b68b6
commit 0b582e6019
27 changed files with 34 additions and 8 deletions

21
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\server.js"
}
]
}

View File

@ -86,9 +86,10 @@ export const updateEvent = async (req, res) => {
description: req.body.description,
location: req.body.location,
};
const files = req.files.image;
if (req.files.image !== "") {
if (req.files) {
const files = req.files.image;
const getEvent = await Events.findById(req.params.id);
const imageId = getEvent.image.public_id;

View File

@ -84,10 +84,11 @@ export const updateNews = async (req, res) => {
title: req.body.title,
description: req.body.description,
};
console.log()
//console.log(req.files)
if (req.files) {
const files = req.files.image;
if (req.files.image !== "") {
const newsImage = await News.findById(req.params.id);
const imgId = newsImage.image.public_id;
@ -105,6 +106,7 @@ export const updateNews = async (req, res) => {
url: myCloud.secure_url,
};
}
console.log(newNewsData)
//req.user.id,
const ModifyNews = await News.findByIdAndUpdate(req.params.id, newNewsData,
@ -119,7 +121,7 @@ export const updateNews = async (req, res) => {
});
} catch (error) {
// console.log(error)
console.log(error)
res.status(500).json({
success: false,
msg: "Failled to UpDate !!"

View File

@ -82,9 +82,10 @@ export const updateCategory = async (req, res) => {
const newCategoryData = {
name: req.body.name,
};
const files = req.files.image;
if (req.files.image !== "") {
if (req.files) {
const categ = await Category.findById(req.params.id);
const imageId = categ.image.public_id;
@ -92,6 +93,7 @@ export const updateCategory = async (req, res) => {
//delete image from claudinary
await cloudinary.uploader.destroy(imageId)
// await cloudinary.uploader.destroy(imageId, function (result) { console.log(result) });
const files = req.files.image;
const myCloud = await cloudinary.uploader.upload(files.tempFilePath, {
folder: "image",
},

BIN
tmp/tmp-1-1655118440699 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655118594429 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1655119127152 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119363158 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119458662 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119503942 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119552520 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119614211 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119671253 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119703079 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119791268 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655119861401 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-1-1655120128960 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 KiB

BIN
tmp/tmp-2-1655118461621 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-2-1655118808779 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-2-1655119191564 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-2-1655119523178 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-3-1655118463051 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-3-1655118880504 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-4-1655118463253 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-4-1655118936552 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-5-1655118463479 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
tmp/tmp-5-1655119079603 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB