Last active
April 25, 2020 11:37
-
-
Save mickaelw/f0b64379c811ba65b75901930e7e9c10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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