@duvdu-v1/duvdu 1.1.241 → 1.1.243
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.
|
@@ -6,8 +6,7 @@ const winston_1 = require("../config/winston");
|
|
|
6
6
|
const custom_error_1 = require("../errors/custom-error");
|
|
7
7
|
// eslint-disable-next-line
|
|
8
8
|
const globalErrorHandlingMiddleware = (err, req, res, next) => {
|
|
9
|
-
|
|
10
|
-
console.log(err);
|
|
9
|
+
console.log(err);
|
|
11
10
|
// custom error
|
|
12
11
|
if (err instanceof custom_error_1.CustomError) {
|
|
13
12
|
return res.status(err.statusCode).json({ errors: err.serializeError() });
|
|
@@ -17,6 +17,9 @@ const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function*
|
|
|
17
17
|
const projectsCount = user.projectsCount;
|
|
18
18
|
const projectsLiked = user.likes;
|
|
19
19
|
const acceptedProjectsCounter = user.acceptedProjectsCounter;
|
|
20
|
+
console.log('acceptedProjectsCounter', acceptedProjectsCounter);
|
|
21
|
+
console.log('projectsLiked', projectsLiked);
|
|
22
|
+
console.log('projectsCount', projectsCount);
|
|
20
23
|
// Find current rank that matches ALL criteria
|
|
21
24
|
const currentRank = yield ranks_model_1.Rank.findOne({
|
|
22
25
|
actionCount: { $lte: acceptedProjectsCounter },
|
|
@@ -30,6 +33,7 @@ const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function*
|
|
|
30
33
|
projectsCount: -1
|
|
31
34
|
})
|
|
32
35
|
.exec();
|
|
36
|
+
console.log('currentRank', currentRank);
|
|
33
37
|
// Find next possible rank
|
|
34
38
|
const nextRank = yield ranks_model_1.Rank.findOne({
|
|
35
39
|
$or: [
|
|
@@ -45,6 +49,7 @@ const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function*
|
|
|
45
49
|
projectsCount: 1
|
|
46
50
|
})
|
|
47
51
|
.exec();
|
|
52
|
+
console.log('nextRank', nextRank);
|
|
48
53
|
if (currentRank) {
|
|
49
54
|
user.rank.title = currentRank.rank;
|
|
50
55
|
user.rank.color = currentRank.color;
|
|
@@ -81,7 +86,8 @@ const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function*
|
|
|
81
86
|
user.rank.nextRankTitle = null;
|
|
82
87
|
user.rank.color = null;
|
|
83
88
|
}
|
|
84
|
-
|
|
89
|
+
yield user.save();
|
|
90
|
+
return user;
|
|
85
91
|
});
|
|
86
92
|
exports.updateRankForUser = updateRankForUser;
|
|
87
93
|
const recalculateAllUsersRanks = () => __awaiter(void 0, void 0, void 0, function* () {
|