first commit
This commit is contained in:
29
src/controllers/wardrobe/wardrobeRecommendationController.js
Normal file
29
src/controllers/wardrobe/wardrobeRecommendationController.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const Wardrobe = require('../../models/mongodb/Wardrobe');
|
||||
|
||||
// @desc Generate outfit recommendations
|
||||
exports.getRecommendations = async (req, res, next) => {
|
||||
try {
|
||||
const wardrobe = await Wardrobe.findByUserId(req.user.id);
|
||||
// if (!wardrobe) return res.status(404).json({ success: false, message: 'Wardrobe not found' });
|
||||
|
||||
if (!wardrobe) {
|
||||
return res.status(404).json({
|
||||
statusCode: 404,
|
||||
status: false,
|
||||
message: "Wardrobe not found",
|
||||
data: null
|
||||
});
|
||||
}
|
||||
|
||||
const recommendations = wardrobe.generateOutfitRecommendations();
|
||||
// res.json({ success: true, data: { recommendations } });
|
||||
return res.status(200).json({
|
||||
statusCode: 200,
|
||||
status: true,
|
||||
message: "Recommendations fetched successfully",
|
||||
data: { recommendations }
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user