tango-api-schema 2.6.31 → 2.6.32

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-api-schema",
3
- "version": "2.6.31",
3
+ "version": "2.6.32",
4
4
  "description": "tangoEye model schema",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -225,4 +225,9 @@ const fixtureConfigSchema = new mongoose.Schema(
225
225
  },
226
226
  );
227
227
 
228
+ // Indexes — covers processFixtureTemplates / submitFixtureFeedback's
229
+ // {clientId, crestMapKey, templateType} aggregate $match. masterTemplateId is
230
+ // already field-level indexed.
231
+ fixtureConfigSchema.index( { clientId: 1, crestMapKey: 1, templateType: 1 } );
232
+
228
233
  export default mongoose.model('fixtureConfig', fixtureConfigSchema);
@@ -78,4 +78,9 @@ const fixtureShelfSchema = new mongoose.Schema(
78
78
  },
79
79
  );
80
80
 
81
+ // Indexes — {fixtureId} covers deleteMany on fixture replace; {floorId} covers
82
+ // zone-response sync; {planoId,floorId} for bulk sweeps. Existing field-level
83
+ // index:true on fixtureId/floorId/planoId is left in place.
84
+ fixtureShelfSchema.index( { planoId: 1, floorId: 1 } );
85
+
81
86
  export default mongoose.model('fixtureShelf', fixtureShelfSchema);
@@ -59,4 +59,9 @@ const planoComplianceSchema = new mongoose.Schema(
59
59
  },
60
60
  );
61
61
 
62
+ // Indexes — {planoId,floorId,date} for getPlanogramDetailsWithRevisions; {planoId,date,compliance}
63
+ // for the daily-compliance $lookup inside getPlanogramList that was running unindexed.
64
+ planoComplianceSchema.index( { planoId: 1, floorId: 1, date: -1 } );
65
+ planoComplianceSchema.index( { planoId: 1, date: -1, compliance: 1 } );
66
+
62
67
  export default mongoose.model( 'planoCompliance', planoComplianceSchema );
@@ -45,5 +45,9 @@ const collection = new mongoose.Schema({
45
45
  versionKey: false,
46
46
  });
47
47
 
48
+ // Indexes — covers getplanoFeedback / getPlanogramComments / submitFixtureFeedback,
49
+ // all of which filter by {planoId,floorId} ± taskType. {taskId} for the taskId $in lookup.
50
+ collection.index( { planoId: 1, floorId: 1, taskType: 1 } );
51
+ collection.index( { taskId: 1 } );
48
52
 
49
53
  export default mongoose.model('planoGlobalComment', collection);
@@ -62,4 +62,9 @@ const planoMappingSchema = new mongoose.Schema(
62
62
  },
63
63
  );
64
64
 
65
+ // Indexes — covers getPlanogramDetailsWithRevisions {fixtureId, shelfId, type}
66
+ // and planoId/floorId-keyed sweeps from compliance/mapping flows.
67
+ planoMappingSchema.index( { fixtureId: 1, shelfId: 1, type: 1 } );
68
+ planoMappingSchema.index( { planoId: 1, floorId: 1, type: 1 } );
69
+
65
70
  export default mongoose.model( 'planoMapping', planoMappingSchema );
@@ -72,4 +72,12 @@ const planoRevisionSchema = new mongoose.Schema({
72
72
  },
73
73
  );
74
74
 
75
+ // Indexes — covers managePlano.getAllPlanoRevisions, getPlanograms (mainline + staging),
76
+ // getPlanogramList, updateMany({floorId}). The {planoId,clientId,isActive,_id} index
77
+ // removes the in-memory SORT in getPlanograms detail loads.
78
+ planoRevisionSchema.index( { planoId: 1, floorId: 1, _id: -1 } );
79
+ planoRevisionSchema.index( { clientId: 1, storeId: 1, _id: -1 } );
80
+ planoRevisionSchema.index( { floorId: 1, _id: -1 } );
81
+ planoRevisionSchema.index( { planoId: 1, clientId: 1, isActive: -1, _id: -1 } );
82
+
75
83
  export default mongoose.model('planoRevision', planoRevisionSchema);
@@ -14,5 +14,11 @@ const planoStaticData = new mongoose.Schema({
14
14
  timestamps: true,
15
15
  },
16
16
  );
17
-
17
+
18
+ // Indexes — almost every read is a findOne by {type} or {clientId,type}.
19
+ // {clientId,type} prefix-covers {clientId}; standalone {type} is needed because
20
+ // many lookups (getplanoFeedback, createTask, fetchIvmConversionAlias) filter by type alone.
21
+ planoStaticData.index( { type: 1 } );
22
+ planoStaticData.index( { clientId: 1, type: 1 } );
23
+
18
24
  export default mongoose.model( 'planoStaticData', planoStaticData);
@@ -421,4 +421,14 @@ const planoTaskCompliance = new mongoose.Schema(
421
421
  }
422
422
  );
423
423
 
424
+ // Indexes — this collection had NONE and is the verification-rollout core.
425
+ // {planoId,floorId,type,_id} primary; {planoId,floorId,fixtureId,type} for the
426
+ // fixture-keyed updateOne in updateAnswers / updateAnswersv2 / approveFixtureTask;
427
+ // {taskId,type} for taskId-keyed lookups in validateTask;
428
+ // {date_string,type} for taskSubmitDetails / generatetaskDetails daily aggregates.
429
+ planoTaskCompliance.index( { planoId: 1, floorId: 1, type: 1, _id: -1 } );
430
+ planoTaskCompliance.index( { planoId: 1, floorId: 1, fixtureId: 1, type: 1 } );
431
+ planoTaskCompliance.index( { taskId: 1, type: 1 } );
432
+ planoTaskCompliance.index( { date_string: 1, type: 1 } );
433
+
424
434
  export default mongoose.model('planotaskcompliance', planoTaskCompliance);
@@ -60,4 +60,9 @@ const planoVmDetailSchema = new mongoose.Schema(
60
60
  },
61
61
  );
62
62
 
63
+ // Indexes — {clientId,vmName} covers getReplaceVmList aggregate and updateFixtureData
64
+ // findOne; standalone {vmName} for updateStorePlano vm-by-name lookups.
65
+ planoVmDetailSchema.index( { clientId: 1, vmName: 1 } );
66
+ planoVmDetailSchema.index( { vmName: 1 } );
67
+
63
68
  export default mongoose.model( 'planoVmDetail', planoVmDetailSchema );
@@ -71,4 +71,9 @@ const planogramSchema = new mongoose.Schema({
71
71
  },
72
72
  );
73
73
 
74
+ // Indexes — covers onboardPlanoList, createPlano(FromCAD|Empty), createTask lookups,
75
+ // getStoresForTouchup, getFixtureNumbersByStore, getFixtureDetailsByStore.
76
+ planogramSchema.index( { clientId: 1, storeId: 1 } );
77
+ planogramSchema.index( { clientId: 1, storeName: 1 } );
78
+
74
79
  export default mongoose.model('planogram', planogramSchema);
@@ -1,31 +1,31 @@
1
- import mongoose from 'mongoose';
2
- import { randomUUID } from 'crypto';
3
-
4
- // schema
5
- const collection = new mongoose.Schema({
6
- apiKey: {
7
- type: String,
8
- required: true,
9
- unique: true,
10
- default: () => randomUUID()
11
- },
12
- countryName: {
13
- type: String,
14
- },
15
- countryCode: {
16
- type: String,
17
- },
18
- clientId: {
19
- type: String,
20
- },
21
- },
22
- {
23
- timestamps: true,
24
- strict: true,
25
- versionKey: false,
26
- });
27
-
28
-
29
- collection.index({ apiKey: 1 });
30
-
31
- export default mongoose.model('regionKey', collection, 'regionKey');
1
+ import mongoose from 'mongoose';
2
+ import { randomUUID } from 'crypto';
3
+
4
+ // schema
5
+ const collection = new mongoose.Schema({
6
+ apiKey: {
7
+ type: String,
8
+ required: true,
9
+ unique: true,
10
+ default: () => randomUUID()
11
+ },
12
+ countryName: {
13
+ type: String,
14
+ },
15
+ countryCode: {
16
+ type: String,
17
+ },
18
+ clientId: {
19
+ type: String,
20
+ },
21
+ },
22
+ {
23
+ timestamps: true,
24
+ strict: true,
25
+ versionKey: false,
26
+ });
27
+
28
+
29
+ collection.index({ apiKey: 1 });
30
+
31
+ export default mongoose.model('regionKey', collection, 'regionKey');
@@ -268,7 +268,14 @@ const storeFixtureSchema = new mongoose.Schema(
268
268
  timestamps: true,
269
269
  },
270
270
  );
271
-
271
+
272
+ // Indexes — {planoId,floorId} primary lookup; {floorId,fixtureType} for layout-touchup
273
+ // queries that filter by fixtureType !== 'other'; {planoId,fixtureNumber} for
274
+ // task/validate flows. Field-level index:true on planoId/floorId stays for safety.
275
+ storeFixtureSchema.index( { planoId: 1, floorId: 1 } );
276
+ storeFixtureSchema.index( { floorId: 1, fixtureType: 1 } );
277
+ storeFixtureSchema.index( { planoId: 1, fixtureNumber: 1 } );
278
+
272
279
  export default mongoose.model( 'storeFixture', storeFixtureSchema );
273
280
 
274
281
 
@@ -95,4 +95,11 @@ const storeLayoutSchema = new mongoose.Schema( {
95
95
  },
96
96
  );
97
97
 
98
+ // Indexes — {planoId,floorNumber} for createPlano(FromCAD|Empty) and floor-number lookups,
99
+ // {storeId,status} for getStoresForTouchup active-store scan.
100
+ // The field-level `index:true` on planoId is left in place (prefix-covered by the compound;
101
+ // can be removed later via syncIndexes if you want to clean up).
102
+ storeLayoutSchema.index( { planoId: 1, floorNumber: 1 } );
103
+ storeLayoutSchema.index( { storeId: 1, status: 1 } );
104
+
98
105
  export default mongoose.model( 'storeLayout', storeLayoutSchema );
@@ -280,5 +280,18 @@ const processedTaskSchema = new mongoose.Schema(
280
280
  timestamps: true,
281
281
  },
282
282
  );
283
-
283
+
284
+ // Indexes — verification rollout task collection. Existing field-level indexes
285
+ // (planoType, planoId, floorId) are now prefix-covered by these compounds; left in
286
+ // place for rollout safety. Drop them later via syncIndexes if desired.
287
+ // {planoId,floorId,isPlano,planoType} covers the deleteMany / updateOne sweeps in
288
+ // createTask, revokeTask, allowEditWithoutRemovingResponse.
289
+ // {date_iso,isPlano,planoType} covers generatetaskDetails daily aggregate.
290
+ // {store_id,userEmail,planoId} covers the createTask upsert.
291
+ // {store_id,scheduleEndTime_iso,isPlano,userId} covers getPlanoTaskDetails.
292
+ processedTaskSchema.index( { planoId: 1, floorId: 1, isPlano: 1, planoType: 1 } );
293
+ processedTaskSchema.index( { date_iso: -1, isPlano: 1, planoType: 1 } );
294
+ processedTaskSchema.index( { store_id: 1, userEmail: 1, planoId: 1 } );
295
+ processedTaskSchema.index( { store_id: 1, scheduleEndTime_iso: 1, isPlano: 1, userId: 1 } );
296
+
284
297
  export default mongoose.model( 'processedTask', processedTaskSchema);