tango-app-api-trax 3.9.49 → 3.9.50

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.9.49",
3
+ "version": "3.9.50",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1822,6 +1822,8 @@ export const checklistDropdownV1 = async ( req, res ) => {
1822
1822
  sourceCheckList_id: 1,
1823
1823
  checkListName: 1,
1824
1824
  coverage: 1,
1825
+ // aiStoreList is an array of store-id strings; keep it (default []).
1826
+ aiStoreList: { $ifNull: [ '$aiStoreList', [] ] },
1825
1827
  },
1826
1828
  },
1827
1829
  {
@@ -1829,6 +1831,8 @@ export const checklistDropdownV1 = async ( req, res ) => {
1829
1831
  _id: '$sourceCheckList_id',
1830
1832
  checkListName: { $last: '$checkListName' },
1831
1833
  coverage: { $last: '$coverage' },
1834
+ // Collect each document's array; flattened/deduped in the next stage.
1835
+ aiStoreList: { $push: '$aiStoreList' },
1832
1836
  },
1833
1837
  },
1834
1838
  {
@@ -1837,6 +1841,14 @@ export const checklistDropdownV1 = async ( req, res ) => {
1837
1841
  sourceCheckList_id: '$_id',
1838
1842
  checkListName: 1,
1839
1843
  coverage: 1,
1844
+ // Union the per-document arrays into one deduplicated list of store ids.
1845
+ aiStoreList: {
1846
+ $reduce: {
1847
+ input: '$aiStoreList',
1848
+ initialValue: [],
1849
+ in: { $setUnion: [ '$$value', '$$this' ] },
1850
+ },
1851
+ },
1840
1852
  },
1841
1853
  },
1842
1854
  {
@@ -1884,6 +1896,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
1884
1896
  scheduleStartTime: '$checklistData.scheduleStartTime',
1885
1897
  sourceCheckList_id: '$checklistData._id',
1886
1898
  coverage: 1,
1899
+ aiStoreList: 1,
1887
1900
  },
1888
1901
  },
1889
1902
  ];