@riocrypto/common-server 1.0.2887 → 1.0.2889

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.
@@ -44,6 +44,8 @@ const buildAdminAction = (mongoose) => {
44
44
  },
45
45
  },
46
46
  });
47
+ // This listing is always unfiltered, so createdAt is the only usable path.
48
+ AdminActionSchema.index({ createdAt: -1, _id: -1 });
47
49
  AdminActionSchema.statics.build = (attrs) => {
48
50
  return new AdminAction(attrs);
49
51
  };
@@ -95,6 +95,8 @@ const buildAdminTask = (mongoose) => {
95
95
  AdminTaskSchema.index({ type: 1, treasuryProvider: 1, status: 1, crypto: 1 });
96
96
  AdminTaskSchema.index({ orderId: 1, type: 1, status: 1 });
97
97
  AdminTaskSchema.index({ reference: 1, treasuryProvider: 1, type: 1 });
98
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
99
+ AdminTaskSchema.index({ createdAt: -1 });
98
100
  AdminTaskSchema.statics.build = (attrs) => {
99
101
  return new AdminTask(attrs);
100
102
  };
@@ -52,6 +52,8 @@ const buildArbitrageSession = (mongoose) => {
52
52
  },
53
53
  },
54
54
  });
55
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
56
+ ArbitrageSessionSchema.index({ createdAt: -1, _id: -1 });
55
57
  ArbitrageSessionSchema.statics.build = (attrs) => {
56
58
  return new ArbitrageSession(attrs);
57
59
  };
@@ -80,6 +80,8 @@ const buildAxe = (mongoose) => {
80
80
  },
81
81
  },
82
82
  });
83
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
84
+ AxeSchema.index({ createdAt: -1, _id: -1 });
83
85
  AxeSchema.statics.build = (attrs) => {
84
86
  return new Axe(attrs);
85
87
  };
@@ -84,6 +84,8 @@ const buildBulkBankPayment = (mongoose) => {
84
84
  },
85
85
  },
86
86
  });
87
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
88
+ BulkBankPaymentSchema.index({ createdAt: -1, _id: -1 });
87
89
  BulkBankPaymentSchema.statics.build = (attrs) => {
88
90
  return new BulkBankPayment(attrs);
89
91
  };
@@ -65,6 +65,8 @@ const buildBulkCryptoPayment = (mongoose) => {
65
65
  },
66
66
  });
67
67
  BulkCryptoPaymentSchema.index({ "paymentsReceived.blockchainTxId": 1 }, { sparse: true });
68
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
69
+ BulkCryptoPaymentSchema.index({ createdAt: -1, _id: -1 });
68
70
  BulkCryptoPaymentSchema.statics.build = (attrs) => {
69
71
  return new BulkCryptoPayment(attrs);
70
72
  };
@@ -66,6 +66,8 @@ const buildCryptoAddress = (mongoose) => {
66
66
  },
67
67
  },
68
68
  });
69
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
70
+ CryptoAddressSchema.index({ createdAt: -1, _id: -1 });
69
71
  CryptoAddressSchema.statics.build = (attrs) => {
70
72
  return new CryptoAddress(attrs);
71
73
  };
@@ -111,6 +111,10 @@ const buildExternalTrade = (mongoose) => {
111
111
  unique: true,
112
112
  partialFilterExpression: { providerOrderId: { $type: "string" } },
113
113
  });
114
+ // Serves the unfiltered admin listing, which sorts on createdAt alone, and
115
+ // the per-provider CSV export, which sorts a whole provider's history.
116
+ ExternalTradeSchema.index({ createdAt: -1, _id: -1 });
117
+ ExternalTradeSchema.index({ provider: 1, createdAt: -1 });
114
118
  ExternalTradeSchema.statics.build = (attrs) => {
115
119
  return new ExternalTrade(attrs);
116
120
  };
@@ -81,6 +81,8 @@ const buildExternalTradingAlgorithm = (mongoose) => {
81
81
  },
82
82
  },
83
83
  });
84
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
85
+ ExternalTradingAlgorithmSchema.index({ createdAt: -1, _id: -1 });
84
86
  ExternalTradingAlgorithmSchema.statics.build = (attrs) => {
85
87
  return new ExternalTradingAlgorithm(attrs);
86
88
  };
@@ -77,6 +77,8 @@ const buildFXTrade = (mongoose) => {
77
77
  },
78
78
  },
79
79
  });
80
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
81
+ FXTradeSchema.index({ createdAt: -1, _id: -1 });
80
82
  FXTradeSchema.statics.build = (attrs) => {
81
83
  return new FXTrade(attrs);
82
84
  };
@@ -79,6 +79,8 @@ const buildInternalTrade = (mongoose) => {
79
79
  },
80
80
  },
81
81
  });
82
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
83
+ InternalTradeSchema.index({ createdAt: -1, _id: -1 });
82
84
  InternalTradeSchema.statics.build = (attrs) => {
83
85
  return new InternalTrade(attrs);
84
86
  };
@@ -168,6 +168,8 @@ const buildInternalTransfer = (mongoose) => {
168
168
  isImported: 1,
169
169
  createdAt: 1,
170
170
  });
171
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
172
+ InternalTransferSchema.index({ createdAt: -1, _id: -1 });
171
173
  InternalTransferSchema.statics.build = (attrs) => {
172
174
  return new InternalTransfer(attrs);
173
175
  };
@@ -53,6 +53,8 @@ const buildInvoice = (mongoose) => {
53
53
  },
54
54
  },
55
55
  });
56
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
57
+ InvoiceSchema.index({ createdAt: -1, _id: -1 });
56
58
  InvoiceSchema.statics.build = (attrs) => {
57
59
  return new Invoice(attrs);
58
60
  };
@@ -64,6 +64,8 @@ const buildLiquidityReservation = (mongoose) => {
64
64
  },
65
65
  },
66
66
  });
67
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
68
+ LiquidityReservationSchema.index({ createdAt: -1, _id: -1 });
67
69
  LiquidityReservationSchema.statics.build = (attrs) => {
68
70
  return new LiquidityReservation(attrs);
69
71
  };
@@ -389,6 +389,11 @@ const buildOrder = (mongoose) => {
389
389
  orderSchema.index({ userId: 1, createdAt: 1, country: 1 });
390
390
  orderSchema.index({ brokerId: 1, createdAt: 1, side: 1, status: 1 });
391
391
  orderSchema.index({ brokerId: 1, createdAt: 1, country: 1 });
392
+ // The admin order list is scoped to neither a user nor a broker, so none of
393
+ // the indexes above can serve it. This mirrors that route's sort exactly, so
394
+ // the date range is an index bound and the page limit can short-circuit
395
+ // instead of sorting the whole match set in memory.
396
+ orderSchema.index({ createdAt: -1, _id: -1 });
392
397
  orderSchema.index({ "TWAP.sessionId": 1 }, { sparse: true });
393
398
  // Sparse: only orders with a pending automated payout retry carry this field,
394
399
  // so the retry cron's due query never scans the full collection.
@@ -133,6 +133,8 @@ const buildTWAPSession = (mongoose) => {
133
133
  },
134
134
  },
135
135
  });
136
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
137
+ TWAPSessionSchema.index({ createdAt: -1, _id: -1 });
136
138
  TWAPSessionSchema.statics.build = (attrs) => {
137
139
  return new TWAPSession(attrs);
138
140
  };
@@ -78,6 +78,8 @@ const buildTWAPSettlement = (mongoose) => {
78
78
  },
79
79
  },
80
80
  });
81
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
82
+ TWAPSettlementSchema.index({ createdAt: -1, _id: -1 });
81
83
  TWAPSettlementSchema.statics.build = (attrs) => {
82
84
  return new TWAPSettlement(attrs);
83
85
  };
@@ -253,6 +253,8 @@ const buildUser = (mongoose) => {
253
253
  },
254
254
  });
255
255
  userSchema.index({ brokerId: 1 });
256
+ // Serves the unfiltered admin listing, which sorts on createdAt alone.
257
+ userSchema.index({ createdAt: -1, _id: -1 });
256
258
  userSchema.statics.build = (attrs) => {
257
259
  return new User(attrs);
258
260
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2887",
3
+ "version": "1.0.2889",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",