make it betterslsf
21
.vscode/launch.json
vendored
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
@ -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;
|
||||
|
@ -84,10 +84,11 @@ export const updateNews = async (req, res) => {
|
||||
title: req.body.title,
|
||||
description: req.body.description,
|
||||
};
|
||||
console.log()
|
||||
const files = req.files.image;
|
||||
//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 !!"
|
||||
|
@ -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
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655118594429
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
tmp/tmp-1-1655119127152
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119363158
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119458662
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119503942
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119552520
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119614211
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119671253
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119703079
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119791268
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655119861401
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-1-1655120128960
Normal file
After Width: | Height: | Size: 620 KiB |
BIN
tmp/tmp-2-1655118461621
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-2-1655118808779
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-2-1655119191564
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-2-1655119523178
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-3-1655118463051
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-3-1655118880504
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-4-1655118463253
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-4-1655118936552
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-5-1655118463479
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
tmp/tmp-5-1655119079603
Normal file
After Width: | Height: | Size: 1.4 MiB |