lib/middleware/events.js
function listEvents(req, res, next){
  var logger = log.logger;
  var EventModel = models.getModels().Event;
  var listReq = RequestTranslator.parseListEventsRequest(req);
  if(! listReq.uid || ! listReq.env || ! listReq.domain){
    return next({"error":"invalid params missing uid env or domain","code":400});
  }
  EventModel.queryEvents(listReq.uid, listReq.env, listReq.domain, function(err, events){
    if(err) {
      logger.error(loggerPrefix + 'Events Query Error: ', err);
      return next(err);
    } else {
      req.resultData =  ResponseTranslator.mapEventsToResponse(events);
      next();
    }
  });
}
function listEvents(req, res, next){
  var logger = log.logger;
  var EventModel = models.getModels().Event;
  var listReq = RequestTranslator.parseListEventsRequest(req);
  if(! listReq.uid || ! listReq.env || ! listReq.domain){
    return next({"error":"invalid params missing uid env or domain","code":400});
  }
  EventModel.queryEvents(listReq.uid, listReq.env, listReq.domain, function(err, events){
    if(err) {
      logger.error(loggerPrefix + 'Events Query Error: ', err);
      return next(err);
    } else {
      req.resultData =  ResponseTranslator.mapEventsToResponse(events);
      next();
    }
  });
}
function listEvents ( req , res , next ) { var logger = log . logger ; var EventModel = models . getModels ( ) . Event ; var listReq = RequestTranslator . parseListEventsRequest ( req ) ; if ( ! listReq . uid || ! listReq . env || ! listReq . domain ) { return next ( { "error" : "invalid params missing uid env or domain" , "code" : 400 } ) ; } EventModel . queryEvents ( listReq . uid , listReq . env , listReq . domain , function ( err , events ) { if ( err ) { logger . error ( loggerPrefix + 'Events Query Error: ' , err ) ; return next ( err ) ; } else { req . resultData = ResponseTranslator . mapEventsToResponse ( events ) ; next ( ) ; } } ) ; }
Return list of Events for domain, env and app id
@param req
@param res
@param next
Return list of Events for domain env and app id