Created
July 1, 2020 15:17
-
-
Save Miczeq22/72c3fa10957db713cf2d73cdc6dd1713 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
function getOrCreateProduct(data: ProductData) { | |
let existingProduct = productRepository.findByAttributes(data); | |
if (!existingProduct) { | |
existingProduct = productRepository.save(data); | |
} | |
return existingProduct; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment