@tmlmobilidade/interfaces 20260201.1128.44 → 20260201.1250.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,10 +92,10 @@ export function ridesPipelineDelayStatus({ filter } = {}) {
92
92
  { $project: { end_delay_diff: 0, start_delay_diff: 0 } },
93
93
  ];
94
94
  // Stage 5: Filter by delay status if provided
95
- if (filter && filter.end_delay_status && filter.end_delay_status.length > 0) {
95
+ if (filter && filter.end_delay_status) {
96
96
  pipeline.push({ $match: { end_delay_status: { $in: filter.end_delay_status } } });
97
97
  }
98
- if (filter && filter.start_delay_status && filter.start_delay_status.length > 0) {
98
+ if (filter && filter.start_delay_status) {
99
99
  pipeline.push({ $match: { start_delay_status: { $in: filter.start_delay_status } } });
100
100
  }
101
101
  return pipeline;
@@ -191,7 +191,7 @@ export function ridesPipelineOperationalStatus({ filter } = {}) {
191
191
  },
192
192
  ];
193
193
  // Stage 5: Filter by operational status if provided
194
- if (filter && filter.operational_status && filter.operational_status.length > 0) {
194
+ if (filter && filter.operational_status) {
195
195
  pipeline.push({ $match: { operational_status: { $in: filter.operational_status } } });
196
196
  }
197
197
  return pipeline;
@@ -261,7 +261,7 @@ export function ridesPipelineSeenStatus({ filter } = {}) {
261
261
  },
262
262
  ];
263
263
  // Stage 5: Filter by seen status if provided
264
- if (filter && filter.seen_status && filter.seen_status.length > 0) {
264
+ if (filter && filter.seen_status) {
265
265
  pipeline.push({ $match: { seen_status: { $in: filter.seen_status } } });
266
266
  }
267
267
  return pipeline;
@@ -352,7 +352,13 @@ export function ridesBatchAggregationPipeline({ ...filter }) {
352
352
  // When 'none' is included, set the field to 'none' if it doesn't exist, then match on the filter array
353
353
  pipeline.push({
354
354
  $addFields: {
355
- [path]: { $ifNull: [`$${path}`, 'none'] },
355
+ [path]: {
356
+ $cond: {
357
+ else: `$${path}`,
358
+ if: { $in: [{ $type: `$${path}` }, ['null', 'undefined']] },
359
+ then: 'none',
360
+ },
361
+ },
356
362
  },
357
363
  });
358
364
  }
@@ -365,7 +371,7 @@ export function ridesBatchAggregationPipeline({ ...filter }) {
365
371
  });
366
372
  // Stage 8: Filter by acceptance status
367
373
  // Only applies filter if acceptance_status is provided and doesn't include 'none'
368
- if (filter.acceptance_status && filter.acceptance_status.length > 0 && !filter.acceptance_status.includes('none')) {
374
+ if (filter.acceptance_status && filter.acceptance_status) {
369
375
  pipeline.push({ $match: { acceptance_status: { $exists: true } } }, { $match: { acceptance_status: { $in: filter.acceptance_status } } });
370
376
  }
371
377
  // Stage 9: Apply status filters using dedicated pipeline functions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20260201.1128.44",
3
+ "version": "20260201.1250.27",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"