How to use aom - 9 common examples

To help you get started, we’ve selected a few aom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github betagouv / preuve-covoiturage / api / services / stats / calculators / duration-all-times.js View on Github external
durationAllTimes({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $group: {
          _id: {
            name: 'duration',
          },
          total: {
            $sum: { $max: ['$passenger.duration', '$passenger.calc_duration'] },
          },
        },
      },
    ];
github betagouv / preuve-covoiturage / api / services / stats / calculators / duration-per-day.js View on Github external
durationPerDay({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          day: { $dayOfMonth: '$passenger.start.datetime' },
          duration: { $max: ['$passenger.duration', '$passenger.calc_duration'] },
        },
      },
      {
        $group: {
          _id: {
github betagouv / preuve-covoiturage / api / services / stats / calculators / journeys-per-day.js View on Github external
journeysPerDay({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          day: { $dayOfMonth: '$passenger.start.datetime' },
        },
      },
      {
        $group: {
          _id: {
            name: 'journeys_per_day',
github betagouv / preuve-covoiturage / api / services / stats / calculators / journeys-per-month.js View on Github external
journeysPerMonth({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
        },
      },
      {
        $group: {
          _id: {
            name: 'journeys_per_month',
            year: '$year',
github betagouv / preuve-covoiturage / api / services / stats / calculators / distance-all-times.js View on Github external
distanceAllTimes({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $group: {
          _id: {
            name: 'distance',
          },
          total: {
            $sum: { $max: ['$passenger.distance', '$passenger.calc_distance'] },
          },
        },
      },
    ];
github betagouv / preuve-covoiturage / api / services / stats / calculators / distance-per-month.js View on Github external
distancePerMonth({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          distance: { $max: ['$passenger.distance', '$passenger.calc_distance'] },
        },
      },
      {
        $group: {
          _id: {
            name: 'distance_per_day',
github betagouv / preuve-covoiturage / api / services / stats / calculators / journeys-all-times.js View on Github external
journeysAllTimes({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const args = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };

    if (aom) args['aom._id'] = aom;

    return {
      collection: 'journeys',
      commands: [
        {
          args,
          command: 'find',
        },
        {
          command: 'count',
        },
      ],
    };
  },
};
github betagouv / preuve-covoiturage / api / services / stats / calculators / distance-per-day.js View on Github external
distancePerDay({ aom = null, startDate = '2019-01-01T00:00:00Z' }) {
    const $match = {
      'passenger.start.datetime': { $gte: startDate, $lt: new Date() },
    };
    if (aom) $match['aom._id'] = aom;

    const args = [
      {
        $match,
      },
      {
        $project: {
          year: { $year: '$passenger.start.datetime' },
          month: { $month: '$passenger.start.datetime' },
          day: { $dayOfMonth: '$passenger.start.datetime' },
          distance: { $max: ['$passenger.distance', '$passenger.calc_distance'] },
        },
      },
      {
        $group: {
          _id: {
github betagouv / preuve-covoiturage / api / src / proofs / proof-controller.js View on Github external
router.get('/download', async (req, res, next) => {
  try {
    const query = {};

    if (_.has(req, 'aom.siren')) {
      query['aom.siren'] = req.aom.siren;
    }

    if (_.has(req, 'operator.siren')) {
      query['operator.siren'] = req.operator.siren;
    }

    res
      .set('Content-type', 'text/csv')
      .send(await proofService.convert(await Proof.find(query), 'csv'));
  } catch (e) {
    next(e);
  }
});

aom

API Over Models: typescript-decorators meta-framework

MIT
Latest version published 2 years ago

Package Health Score

36 / 100
Full package analysis

Popular aom functions