Skip to content

Commit

Permalink
refactor: add removeCarrinho method
Browse files Browse the repository at this point in the history
  • Loading branch information
edumaxsantos committed Oct 18, 2022
1 parent 74a71e2 commit 8fbbb1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/services/carrinhos-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ exports.deleteById = async id => {
return datastore.remove({ _id: id }, {})
}

exports.removeCarrinho = async carrinho => {
const { produtos, _id } = carrinho
this.reabasteceEstoque(produtos)
await this.deleteById(_id)
}

exports.getCarrinhoDoUsuario = async (authorization) => {
const _id = await idUsuario(authorization)
return this.getAll({ idUsuario: _id })
Expand Down

0 comments on commit 8fbbb1b

Please sign in to comment.