module.exports = function(City) {
  City.search = function(query, callback) {
    // TODO: sanitize query
    City.find(
      {
        where: {
          name: {
            like: '%' + query + '%'
          }
        }
      }, function (err, results) {
        callback(null, results);
      }
    );
  };

  City.remoteMethod(
    'search',
    {
      http: { verb: 'get' },
      accepts: { arg: 'query', type: 'string' },
      returns: { arg: 'results', type: [ 'object' ] }
    }
  );
};

module.exports = function(City) {
  City.search = function(query, callback) {
    // TODO: sanitize query
    City.find(
      {
        where: {
          name: {
            like: '%' + query + '%'
          }
        },
        include: [
          'region'
        ]
      }, function (err, results) {
        callback(null, results);
      }
    );
  };

  City.remoteMethod(
    'search',
    {
      http: { verb: 'get' },
      accepts: { arg: 'query', type: 'string' },
      returns: { arg: 'results', type: [ 'object' ] }
    }
  );
};

Include region model on City search
Include region model on City search
