@riocrypto/common-server 1.0.1311 → 1.0.1312
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.
|
@@ -8,22 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.getUserTransactionLimits = void 0;
|
|
16
|
-
const mongoose_1 = __importDefault(require("mongoose"));
|
|
17
13
|
const user_1 = require("../models/user");
|
|
18
14
|
const common_1 = require("@riocrypto/common");
|
|
19
15
|
const calculate_aggregate_volume_and_revenue_1 = require("./calculate-aggregate-volume-and-revenue");
|
|
20
|
-
const getUserTransactionLimits = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
const User = (0, user_1.buildUser)(
|
|
16
|
+
const getUserTransactionLimits = (mongoose, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const User = (0, user_1.buildUser)(mongoose);
|
|
22
18
|
const user = yield User.findById(id);
|
|
23
19
|
if (!user) {
|
|
24
20
|
throw new common_1.NotFoundError("User");
|
|
25
21
|
}
|
|
26
|
-
const { volume } = yield (0, calculate_aggregate_volume_and_revenue_1.calculateAggregateVolumeAndRevenue)(
|
|
22
|
+
const { volume } = yield (0, calculate_aggregate_volume_and_revenue_1.calculateAggregateVolumeAndRevenue)(mongoose, 30, user, true);
|
|
27
23
|
const { riskTier } = user;
|
|
28
24
|
let limit = 0;
|
|
29
25
|
if (riskTier === common_1.RiskTier.High) {
|