vanta-api 1.3.0 → 1.3.1
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 +1 -1
- package/src/api-features.js +0 -7
package/package.json
CHANGED
package/src/api-features.js
CHANGED
|
@@ -86,9 +86,7 @@ export class ApiFeatures {
|
|
|
86
86
|
if (f.startsWith("-")) excludeFields.add(f.slice(1));
|
|
87
87
|
else includeFields.add(f);
|
|
88
88
|
});
|
|
89
|
-
|
|
90
89
|
const project = {};
|
|
91
|
-
|
|
92
90
|
if (includeFields.size > 0) {
|
|
93
91
|
includeFields.forEach((f) => {
|
|
94
92
|
if (validFields.includes(f)) project[f] = 1;
|
|
@@ -105,7 +103,6 @@ export class ApiFeatures {
|
|
|
105
103
|
|
|
106
104
|
return this;
|
|
107
105
|
}
|
|
108
|
-
|
|
109
106
|
paginate() {
|
|
110
107
|
const { maxLimit } = securityConfig.accessLevels[this.userRole] || {
|
|
111
108
|
maxLimit: 100,
|
|
@@ -252,7 +249,6 @@ export class ApiFeatures {
|
|
|
252
249
|
|
|
253
250
|
_parseQueryFilters() {
|
|
254
251
|
const obj = { ...this.query };
|
|
255
|
-
// پاک کردن پارامترهای سیستماتیک
|
|
256
252
|
["page", "limit", "sort", "fields", "populate"].forEach(
|
|
257
253
|
(k) => delete obj[k]
|
|
258
254
|
);
|
|
@@ -343,9 +339,6 @@ export class ApiFeatures {
|
|
|
343
339
|
_applySecurityFilters(filters) {
|
|
344
340
|
let res = { ...filters };
|
|
345
341
|
securityConfig.forbiddenFields.forEach((f) => delete res[f]);
|
|
346
|
-
if (this.userRole !== "admin" && this.model.schema.path("isActive")) {
|
|
347
|
-
res.isActive = true;
|
|
348
|
-
}
|
|
349
342
|
return res;
|
|
350
343
|
}
|
|
351
344
|
|