Untitled
unknown
plain_text
2 years ago
515 B
7
Indexable
const insertSale = async (req, res) => {
const sale = req.body;
try {
const insertedSaleID = await salesService.insertProductIntoSale(sale);
const productsSold = await salesService.getSaleByIdService(insertedSaleID)
.then((item) => item.map(({ productId, quantity }) => ({ productId, quantity })));
res.status(201).json({ id: insertedSaleID, itemsSold: productsSold });
} catch (error) {
res.status(500).json({ message: error.message });
}
};
// IMPORTANDO ESSA BOSTA AQUI
insertSale,Editor is loading...
Leave a Comment