module.exports = Self => { Self.remoteMethod('upcoming', { description: 'Returns the lastest campaigns', accessType: 'READ', accepts: [], returns: { type: ['object'], root: true }, http: { path: `/upcoming`, verb: 'GET' } }); Self.upcoming = async() => { const minDate = new Date(); minDate.setMonth(0); minDate.setDate(1); return Self.findOne({ where: { dated: { lt: minDate } }, order: 'dated DESC' }); }; };