-function search (value, field, start, count, sort, callback) {
- const query = {}
+function loadAndPopulateAuthor (id, callback) {
+ const options = {
+ include: [ this.sequelize.models.Author ]
+ }
+
+ return this.findById(id, options).asCallback(callback)
+}
+
+function loadAndPopulateAuthorAndPod (id, callback) {
+ const options = {
+ include: [
+ {
+ model: this.sequelize.models.Author,
+ include: [ this.sequelize.models.Pod ]
+ }
+ ]
+ }
+
+ return this.findById(id, options).asCallback(callback)
+}
+
+function searchAndPopulateAuthorAndPod (value, field, start, count, sort, callback) {
+ const podInclude = {
+ model: this.sequelize.models.Pod
+ }
+ const authorInclude = {
+ model: this.sequelize.models.Author,
+ include: [
+ podInclude
+ ]
+ }
+
+ const query = {
+ where: {},
+ include: [
+ authorInclude
+ ],
+ offset: start,
+ limit: count,
+ order: [ modelUtils.getSort(sort) ]
+ }
+
+ // TODO: include our pod for podHost searches (we are not stored in the database)