Skip to content

Instantly share code, notes, and snippets.

@MariusBongarts
Created August 7, 2021 10:55
Show Gist options
  • Save MariusBongarts/3e8f49b40cf114f2a2d58cab12ebc2fb to your computer and use it in GitHub Desktop.
Save MariusBongarts/3e8f49b40cf114f2a2d58cab12ebc2fb to your computer and use it in GitHub Desktop.
DRY - Create
async create(user: User, product: Product): Promise<Product | undefined> {
if (userIsPermitted(user)) {
console.log(`Create product.`);
return this.db.create({user, product});
}
return undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment