Untitled
unknown
plain_text
a year ago
515 B
6
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