make it bettersl

This commit is contained in:
pawan-dot 2022-06-10 22:22:41 +05:30
parent ff8e0f12b7
commit dea52385f5
10 changed files with 6 additions and 6 deletions

View File

@ -3,15 +3,16 @@ import cloudinary from "cloudinary";
export const createDirectory = async (req, res) => { export const createDirectory = async (req, res) => {
try { try {
let image; let images;
// console.log(req.files) // console.log(req.body)
if (req.files !== null) { // console.log(req.files.image)
if (req.files) {
const files = req.files.image; const files = req.files.image;
const myCloud = await cloudinary.uploader.upload(files.tempFilePath, { const myCloud = await cloudinary.uploader.upload(files.tempFilePath, {
folder: "cmp/image", folder: "cmp/image",
}, },
function (error, result) { (result, error) }); function (error, result) { (result, error) });
image = { images = {
public_id: myCloud.public_id, public_id: myCloud.public_id,
url: myCloud.secure_url, url: myCloud.secure_url,
} }
@ -32,7 +33,6 @@ export const createDirectory = async (req, res) => {
FacebookUrl, FacebookUrl,
InstagramUrl, InstagramUrl,
} = req.body; } = req.body;
// console.log(req.body)
const data = await directoryModel.create({ const data = await directoryModel.create({
name, name,
@ -49,7 +49,7 @@ export const createDirectory = async (req, res) => {
LinkedinUrl, LinkedinUrl,
FacebookUrl, FacebookUrl,
InstagramUrl, InstagramUrl,
image: image image: images
}); });
res.status(201).json({ res.status(201).json({

BIN
tmp/tmp-1-1654878203409 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654878668365 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654879240003 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654879315699 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654879381712 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654879478391 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-1-1654879780998 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-2-1654878217852 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
tmp/tmp-2-1654878672959 Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB