module.exports = Self => { Self.remoteMethod('upcoming', { description: 'Returns the upcoming campaign', accessType: 'READ', accepts: [], returns: { type: ['object'], root: true }, http: { path: `/upcoming`, verb: 'GET' } }); Self.upcoming = async() => { const minDate = new Date(); minDate.setFullYear(minDate.getFullYear() - 1); return Self.findOne({ where: { dated: { gte: minDate } }, order: 'dated ASC' }); }; };