speedly 1.2.36 → 1.2.38
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/dist/cjs/db/db.js +3 -0
- package/dist/esm/db/db.js +3 -0
- package/package.json +1 -1
package/dist/cjs/db/db.js
CHANGED
|
@@ -23,6 +23,8 @@ const usingMongoDb = (collectionName, config = { type: 'external' }) => {
|
|
|
23
23
|
if (config?.path)
|
|
24
24
|
__path = config.path;
|
|
25
25
|
model = require(path_1.default.join(...(config.type == 'external' ? [require.main?.filename || './', __path] : ['../model']), collectionName));
|
|
26
|
+
if (model.default)
|
|
27
|
+
model = model.default;
|
|
26
28
|
const actionHandler = {
|
|
27
29
|
find: (match = {}) => {
|
|
28
30
|
queryState.action = "find";
|
|
@@ -205,6 +207,7 @@ const usingMongoDb = (collectionName, config = { type: 'external' }) => {
|
|
|
205
207
|
const limit = parseInt(Array.isArray(req.query.limit) ? String(req.query.limit[0]) : typeof req.query.limit === 'string' ? req.query.limit : req.query.limit !== undefined ? String(req.query.limit) : '') ||
|
|
206
208
|
configs.pagination?.quantity ||
|
|
207
209
|
20;
|
|
210
|
+
console.log('db', 261, model, config.path);
|
|
208
211
|
const totalPages = Math.ceil((await model.countDocuments(match)) / limit);
|
|
209
212
|
detail = {
|
|
210
213
|
...detail,
|
package/dist/esm/db/db.js
CHANGED
|
@@ -23,6 +23,8 @@ const usingMongoDb = (collectionName, config = { type: 'external' }) => {
|
|
|
23
23
|
if (config?.path)
|
|
24
24
|
__path = config.path;
|
|
25
25
|
model = require(path_1.default.join(...(config.type == 'external' ? [require.main?.filename || './', __path] : ['../model']), collectionName));
|
|
26
|
+
if (model.default)
|
|
27
|
+
model = model.default;
|
|
26
28
|
const actionHandler = {
|
|
27
29
|
find: (match = {}) => {
|
|
28
30
|
queryState.action = "find";
|
|
@@ -205,6 +207,7 @@ const usingMongoDb = (collectionName, config = { type: 'external' }) => {
|
|
|
205
207
|
const limit = parseInt(Array.isArray(req.query.limit) ? String(req.query.limit[0]) : typeof req.query.limit === 'string' ? req.query.limit : req.query.limit !== undefined ? String(req.query.limit) : '') ||
|
|
206
208
|
configs.pagination?.quantity ||
|
|
207
209
|
20;
|
|
210
|
+
console.log('db', 261, model, config.path);
|
|
208
211
|
const totalPages = Math.ceil((await model.countDocuments(match)) / limit);
|
|
209
212
|
detail = {
|
|
210
213
|
...detail,
|