Created
March 11, 2018 16:50
-
-
Save mezod/5a9a70efa8a2f5c078cbc75550c0a87b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
* get(params, user_id) { | |
const query = knex | |
.select(['habits.*', | |
'dates.created_at as dates_created_at', 'dates.date', 'dates.skip']) | |
.where({ user_id }) | |
.orderBy('position', 'ASC') | |
.from('habits'); | |
if (params.stats) { | |
query.leftJoin('dates', 'habits.id', '=', 'dates.habit_id'); | |
} | |
return yield query | |
.then(habits => habits); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment