tango-api-schema 2.6.31 → 2.6.33

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.
@@ -1,61 +1,61 @@
1
- import mongoose from 'mongoose';
2
-
3
- const paymentAccountSchema = new mongoose.Schema(
4
- {
5
- clientId: {
6
- type: String,
7
- required: true,
8
- unique: true,
9
- },
10
- customerId:{
11
- type: String,
12
- required: true,
13
- unique: true,
14
- },
15
- virtualAccId:{
16
- type: String,
17
- required: true,
18
- unique: true,
19
- },
20
- bankAccId:{
21
- type: String,
22
- required: true,
23
- unique: true,
24
- },
25
- accountNumber:{
26
- type: String,
27
- required: true,
28
- unique: true,
29
- },
30
- paymentType:{
31
- type: String,
32
- },
33
- status:{
34
- type: String,
35
- },
36
- ifsc: {
37
- type: String,
38
- },
39
- swiftCode:{
40
- type: String,
41
- },
42
- branch:{
43
- type: String,
44
- },
45
- credit:{
46
- type: Number,
47
- default:0
48
- },
49
- currency: {
50
- type: String,
51
- enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
52
- },
53
- },
54
- {
55
- strict: true,
56
- versionKey: false,
57
- timestamps: true,
58
- },
59
- );
60
-
1
+ import mongoose from 'mongoose';
2
+
3
+ const paymentAccountSchema = new mongoose.Schema(
4
+ {
5
+ clientId: {
6
+ type: String,
7
+ required: true,
8
+ unique: true,
9
+ },
10
+ customerId:{
11
+ type: String,
12
+ required: true,
13
+ unique: true,
14
+ },
15
+ virtualAccId:{
16
+ type: String,
17
+ required: true,
18
+ unique: true,
19
+ },
20
+ bankAccId:{
21
+ type: String,
22
+ required: true,
23
+ unique: true,
24
+ },
25
+ accountNumber:{
26
+ type: String,
27
+ required: true,
28
+ unique: true,
29
+ },
30
+ paymentType:{
31
+ type: String,
32
+ },
33
+ status:{
34
+ type: String,
35
+ },
36
+ ifsc: {
37
+ type: String,
38
+ },
39
+ swiftCode:{
40
+ type: String,
41
+ },
42
+ branch:{
43
+ type: String,
44
+ },
45
+ credit:{
46
+ type: Number,
47
+ default:0
48
+ },
49
+ currency: {
50
+ type: String,
51
+ enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
52
+ },
53
+ },
54
+ {
55
+ strict: true,
56
+ versionKey: false,
57
+ timestamps: true,
58
+ },
59
+ );
60
+
61
61
  export default mongoose.model( 'paymentAccount', paymentAccountSchema);
@@ -1,47 +1,47 @@
1
- import mongoose from 'mongoose';
2
-
3
- // Payment reminder configuration per client (brand). One document per
4
- // clientId, driving which reminder emails go out and to whom. Stored in its
5
- // own `paymentreminders` collection.
6
- const paymentReminderSchema = new mongoose.Schema(
7
- {
8
- clientId: {
9
- type: String,
10
- index: true,
11
- },
12
- // Recipients for all reminder emails on this brand.
13
- reminderEmails: {
14
- type: [ String ],
15
- default: [],
16
- },
17
- // Predefined reminder templates the team can toggle. preDue carries a
18
- // configurable lead time; the rest fire on fixed rules.
19
- templates: {
20
- preDue: {
21
- enabled: { type: Boolean, default: true },
22
- daysBefore: { type: Number, default: 3, min: 1, max: 365 },
23
- },
24
- onDue: {
25
- enabled: { type: Boolean, default: true },
26
- },
27
- onHold: {
28
- enabled: { type: Boolean, default: true },
29
- },
30
- suspend: {
31
- enabled: { type: Boolean, default: true },
32
- },
33
- deactivated: {
34
- enabled: { type: Boolean, default: false },
35
- },
36
- },
37
- updatedBy: {
38
- type: String,
39
- },
40
- }, {
41
- strict: true,
42
- versionKey: false,
43
- timestamps: true,
44
- }
45
- );
46
-
1
+ import mongoose from 'mongoose';
2
+
3
+ // Payment reminder configuration per client (brand). One document per
4
+ // clientId, driving which reminder emails go out and to whom. Stored in its
5
+ // own `paymentreminders` collection.
6
+ const paymentReminderSchema = new mongoose.Schema(
7
+ {
8
+ clientId: {
9
+ type: String,
10
+ index: true,
11
+ },
12
+ // Recipients for all reminder emails on this brand.
13
+ reminderEmails: {
14
+ type: [ String ],
15
+ default: [],
16
+ },
17
+ // Predefined reminder templates the team can toggle. preDue carries a
18
+ // configurable lead time; the rest fire on fixed rules.
19
+ templates: {
20
+ preDue: {
21
+ enabled: { type: Boolean, default: true },
22
+ daysBefore: { type: Number, default: 3, min: 1, max: 365 },
23
+ },
24
+ onDue: {
25
+ enabled: { type: Boolean, default: true },
26
+ },
27
+ onHold: {
28
+ enabled: { type: Boolean, default: true },
29
+ },
30
+ suspend: {
31
+ enabled: { type: Boolean, default: true },
32
+ },
33
+ deactivated: {
34
+ enabled: { type: Boolean, default: false },
35
+ },
36
+ },
37
+ updatedBy: {
38
+ type: String,
39
+ },
40
+ }, {
41
+ strict: true,
42
+ versionKey: false,
43
+ timestamps: true,
44
+ }
45
+ );
46
+
47
47
  export default mongoose.model( 'paymentreminder', paymentReminderSchema );
@@ -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);
@@ -1,55 +1,55 @@
1
- import mongoose from 'mongoose';
2
-
3
- const transactionSchema = new mongoose.Schema(
4
- {
5
- clientId: {
6
- type: String
7
- },
8
- orderId: {
9
- type: String
10
- },
11
- paymentId: {
12
- type: String
13
- },
14
- debtType: {
15
- type: String,
16
- enum: [ 'wallet', 'razor' ],
17
- },
18
- billingDate: {
19
- type: Date
20
- },
21
- invoice: {
22
- type: String
23
- },
24
- groupName: {
25
- type: String
26
- },
27
- groupId: {
28
- type: mongoose.Types.ObjectId
29
- },
30
- amount: {
31
- type: Number
32
- },
33
- currency: {
34
- type: String,
35
- enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
36
- },
37
- transactionType: {
38
- type: String,
39
- enum: [ 'credit', 'debt' ],
40
- },
41
- balanceCredit: {
42
- type: Number
43
- },
44
- balanceCreditCurrency: {
45
- type: String,
46
- enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
47
- },
48
- }, {
49
- strict: true,
50
- versionKey: false,
51
- timestamps: true,
52
- }
53
- )
54
-
1
+ import mongoose from 'mongoose';
2
+
3
+ const transactionSchema = new mongoose.Schema(
4
+ {
5
+ clientId: {
6
+ type: String
7
+ },
8
+ orderId: {
9
+ type: String
10
+ },
11
+ paymentId: {
12
+ type: String
13
+ },
14
+ debtType: {
15
+ type: String,
16
+ enum: [ 'wallet', 'razor' ],
17
+ },
18
+ billingDate: {
19
+ type: Date
20
+ },
21
+ invoice: {
22
+ type: String
23
+ },
24
+ groupName: {
25
+ type: String
26
+ },
27
+ groupId: {
28
+ type: mongoose.Types.ObjectId
29
+ },
30
+ amount: {
31
+ type: Number
32
+ },
33
+ currency: {
34
+ type: String,
35
+ enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
36
+ },
37
+ transactionType: {
38
+ type: String,
39
+ enum: [ 'credit', 'debt' ],
40
+ },
41
+ balanceCredit: {
42
+ type: Number
43
+ },
44
+ balanceCreditCurrency: {
45
+ type: String,
46
+ enum: [ 'dollar', 'inr', 'singaporedollar', 'euro', 'aed' ],
47
+ },
48
+ }, {
49
+ strict: true,
50
+ versionKey: false,
51
+ timestamps: true,
52
+ }
53
+ )
54
+
55
55
  export default mongoose.model('transaction', transactionSchema);