Skip to content

Instantly share code, notes, and snippets.

@Eth3rnit3
Created November 28, 2018 16:22
Show Gist options
  • Save Eth3rnit3/76ba9b0d13e2cd00d03b08f09b465d68 to your computer and use it in GitHub Desktop.
Save Eth3rnit3/76ba9b0d13e2cd00d03b08f09b465d68 to your computer and use it in GitHub Desktop.
const models = require('./models');
const User = models.User;
const Company = models.Company;
const WorkingDay = models.WorkingDay;
// // Get workingDays for a given User
User.findByPk(1, {include: ['days']})
.then((user) => {
console.log(user.get())
})
.catch((err) => console.log("Error while searching user : ", err))
// Get Users for a given WorkingDay
WorkingDay.findByPk(1, {include: ['employes']})
.then((workingDay) => {
console.log(workingDay.get())
})
.catch((err) => console.log("Error while searching workingDay : ", err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment