Skip to content

Instantly share code, notes, and snippets.

@david-mart
Created June 11, 2019 20:43
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 david-mart/e052adfc060837082e55aa6aa12f52bd to your computer and use it in GitHub Desktop.
Save david-mart/e052adfc060837082e55aa6aa12f52bd to your computer and use it in GitHub Desktop.
const order = await UsersDb.models.order.findOne({ where: { id: 1 } });
await order.createProduct({ name: 'oathkeeper' });
await order.createProduct({ name: 'longclaw' });
await order.createProduct({ name: 'needle' });
const products = await order.getProducts();
console.log(products);
// output
[ { id: 1, order_id: 1, name: 'oathkeeper' },
{ id: 2, order_id: 1, name: 'longclaw' },
{ id: 3, order_id: 1, name: 'needle' } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment