From 6f57bb792bc3ac5417780d522f150f4f59edd4d1 Mon Sep 17 00:00:00 2001 From: singharaj usai Date: Wed, 16 Oct 2024 19:58:48 -0400 Subject: [PATCH] accept incoming changes --- server/functions/api/routes/shirt.js | 31 ---------------------------- 1 file changed, 31 deletions(-) diff --git a/server/functions/api/routes/shirt.js b/server/functions/api/routes/shirt.js index 5f86691..41f093a 100644 --- a/server/functions/api/routes/shirt.js +++ b/server/functions/api/routes/shirt.js @@ -87,15 +87,9 @@ router.get('/user', authenticateToken, async (req, res) => { // Fetch shirts created by user const createdShirts = await Asset.find({ -<<<<<<< HEAD - creator: user.userId, - AssetType: 'Shirt', - }); -======= creator: user._id, AssetType: 'Shirt', }).populate('creator', 'username'); ->>>>>>> revert-to-avatar-page-paginate console.log('Created shirts found:', createdShirts.length); @@ -103,11 +97,7 @@ router.get('/user', authenticateToken, async (req, res) => { const ownedShirts = await Asset.find({ _id: { $in: user.inventory }, AssetType: 'Shirt', -<<<<<<< HEAD - }); -======= }).populate('creator', 'username'); ->>>>>>> revert-to-avatar-page-paginate console.log('Owned shirts found:', ownedShirts.length); @@ -142,21 +132,6 @@ router.get('/user', authenticateToken, async (req, res) => { router.get('/:id', async (req, res) => { try { const id = req.params.id; -<<<<<<< HEAD - const shirt = await Asset.findOne({ assetId: id, AssetType: 'Shirt' }); - if (!shirt) { - return res.status(404).json({ error: 'Shirt not found' }); - } - const user = await User.findOne({ userId: shirt.creator }); - const shirtWithUsername = { - ...shirt.toObject(), - creatorUsername: user ? user.username : 'Unknown', - }; - res.json(shirtWithUsername); - } catch (error) { - console.error('Error fetching shirt:', error); - res.status(500).json({ error: 'Error fetching shirt', details: error.message }); -======= const shirt = await Asset.findOne({ _id: id, AssetType: 'Shirt' }).populate( 'creator', 'username' @@ -170,7 +145,6 @@ router.get('/:id', async (req, res) => { res .status(500) .json({ error: 'Error fetching shirt', details: error.message }); ->>>>>>> revert-to-avatar-page-paginate } }); @@ -293,13 +267,8 @@ router.post( await thumbnailQueue.addToQueue(shirtassetId, 'Shirt'); -<<<<<<< HEAD - await User.findOneAndUpdate({ userId: req.user.userId }, { - $push: { shirts: shirt.assetId }, -======= await User.findByIdAndUpdate(req.user._id, { $push: { shirts: shirt._id }, ->>>>>>> revert-to-avatar-page-paginate }); res.status(201).json({ shirtId: shirt.assetId, assetId: shirt.assetId });