Skip to content

Instantly share code, notes, and snippets.

@mickaelw
Last active April 25, 2020 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickaelw/f0b64379c811ba65b75901930e7e9c10 to your computer and use it in GitHub Desktop.
Save mickaelw/f0b64379c811ba65b75901930e7e9c10 to your computer and use it in GitHub Desktop.
export class AddToBasket {
constructor(private basketRepository: BasketRepository) {
}
async execute(book: Book): Promise<void> {
const basket = await this.basketRepository.getBasket()
basket.add(book)
return this.basketRepository.save(basket)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment