@riocrypto/common-server 1.0.1576 → 1.0.1578
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/build/models/user.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ interface UserAttrs {
|
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
97
|
quotationTime?: number;
|
|
98
|
+
referrerId?: string;
|
|
98
99
|
}
|
|
99
100
|
interface UserModel extends Model<UserDoc> {
|
|
100
101
|
build(attrs: UserAttrs): UserDoc;
|
|
@@ -195,6 +196,7 @@ interface UserDoc extends Document {
|
|
|
195
196
|
};
|
|
196
197
|
};
|
|
197
198
|
quotationTime?: number;
|
|
199
|
+
referrerId?: string;
|
|
198
200
|
}
|
|
199
201
|
declare const buildUser: (mongoose: Mongoose) => UserModel;
|
|
200
202
|
export { buildUser, UserDoc, UserAttrs };
|
package/build/models/user.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requireAdminAuthIfDefined = void 0;
|
|
4
|
-
const
|
|
5
|
-
const requireAdminAuthIfDefined = (user) => (value, { req, path }) => {
|
|
4
|
+
const requireAdminAuthIfDefined = (value, { req, path }) => {
|
|
6
5
|
if (value !== undefined &&
|
|
7
6
|
value !== "" &&
|
|
8
7
|
!req.adminAuth &&
|
|
9
8
|
// @ts-ignore
|
|
10
|
-
(
|
|
11
|
-
|
|
9
|
+
getValueByPath(req.userToUpdate, path) !== undefined &&
|
|
10
|
+
getValueByPath(req.userToUpdate, path) !== "" &&
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
getValueByPath(req.userToUpdate, path) !== value) {
|
|
13
|
+
return false;
|
|
12
14
|
}
|
|
13
15
|
return true;
|
|
14
16
|
};
|
|
15
17
|
exports.requireAdminAuthIfDefined = requireAdminAuthIfDefined;
|
|
18
|
+
function getValueByPath(obj, path) {
|
|
19
|
+
const keys = path.split(".");
|
|
20
|
+
let current = obj;
|
|
21
|
+
for (let key of keys) {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
current = current[key];
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1578",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
29
|
"@google-cloud/vision": "^4.0.2",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1407",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.6.0",
|
|
34
34
|
"ccxt": "^3.0.30",
|