Skip to content

Instantly share code, notes, and snippets.

@vonvick
Created February 6, 2019 17:27
Show Gist options
  • Save vonvick/945dc8cdafb3264d80686e589e6c5b79 to your computer and use it in GitHub Desktop.
Save vonvick/945dc8cdafb3264d80686e589e6c5b79 to your computer and use it in GitHub Desktop.
sequelize option property
// passing the model type to return the result as the instance of the model
currentMonthEarnings = await db.sequelize.query('SELECT SUM("priceEstimate") FROM "Orders" WHERE "assignedCarId" IN(:ids) AND "createdAt" < (:createdDate)', {
replacements: {ids: carIds, createdDate: currentDateMonth},
model: db.Order,
mapToModel: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment