From cdde70073447b0cde36de227d09f31cebc5a9f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B5=ED=9D=AC=20=EA=B9=80?= Date: Fri, 6 Dec 2024 03:59:24 +0900 Subject: [PATCH] =?UTF-8?q?=EC=83=B5=20=EC=97=85=EB=A1=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/shop.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/controllers/shop.js b/src/controllers/shop.js index 95d1838..d199271 100644 --- a/src/controllers/shop.js +++ b/src/controllers/shop.js @@ -291,25 +291,25 @@ const createShopByUser = async (req, res) => { const { logo, cover, ...others } = req.body; const logoBlurDataURL = await getBlurDataURL(logo?.url); const coverBlurDataURL = await getBlurDataURL(cover?.url); - // const shop = user?.shop ? await Shop.findById(user?.shop.toString()) : null; - // if (shop) { - // await Shop.findByIdAndUpdate(shop._id, { - // ...others, - // logo: { - // ...logo, - // blurDataURL: logoBlurDataURL, - // }, - // cover: { - // ...cover, - // blurDataURL: coverBlurDataURL, - // }, - // status: 'pending', - // }); - // return res.status(200).json({ - // success: true, - // message: 'Shop updated', - // }); - // } + const shop = user?.shop ? await Shop.findById(user?.shop.toString()) : null; + if (shop) { + await Shop.findByIdAndUpdate(shop._id, { + ...others, + logo: { + ...logo, + blurDataURL: logoBlurDataURL, + }, + cover: { + ...cover, + blurDataURL: coverBlurDataURL, + }, + status: 'pending', + }); + return res.status(200).json({ + success: true, + message: 'Shop updated', + }); + } const createdShop = await Shop.create({ vendor: user._id.toString(), ...others,