@duvdu-v1/duvdu 1.1.228 → 1.1.229

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.
@@ -70,7 +70,6 @@ const userSchema = new mongoose_1.Schema({
70
70
  haveInvitation: { type: Boolean, default: false },
71
71
  faceRecognition: { type: String, default: null },
72
72
  projectsCount: { type: Number, default: 0 },
73
- favoriteCount: { type: Number, default: 0 },
74
73
  }, {
75
74
  timestamps: true,
76
75
  collection: model_names_1.MODELS.user,
@@ -91,8 +90,7 @@ userSchema.pre('save', function (next) {
91
90
  return __awaiter(this, void 0, void 0, function* () {
92
91
  if (this.isModified('acceptedProjectsCounter') ||
93
92
  this.isModified('likes') ||
94
- this.isModified('projectsCount') ||
95
- this.isModified('favoriteCount')) {
93
+ this.isModified('projectsCount')) {
96
94
  yield (0, rank_service_1.updateRankForUser)(this);
97
95
  }
98
96
  next();
@@ -7,7 +7,6 @@ exports.Rank = (0, mongoose_1.model)(model_names_1.MODELS.rank, new mongoose_1.S
7
7
  actionCount: { type: Number, unique: true, default: 0 },
8
8
  rank: { type: String, unique: true, default: null },
9
9
  color: { type: String, default: null },
10
- favoriteCount: { type: Number, default: 0 },
11
10
  projectsLiked: { type: Number, default: 0 },
12
11
  projectsCount: { type: Number, default: 0 },
13
12
  }, { timestamps: true, collection: model_names_1.MODELS.rank }));
@@ -15,13 +15,11 @@ const User_model_1 = require("../models/User.model");
15
15
  const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function* () {
16
16
  // get all user stats
17
17
  const projectsCount = user.projectsCount;
18
- const favoriteCount = user.favoriteCount;
19
18
  const projectsLiked = user.likes;
20
19
  const acceptedProjectsCounter = user.acceptedProjectsCounter;
21
20
  // Find current rank that matches ALL criteria
22
21
  const currentRank = yield ranks_model_1.Rank.findOne({
23
22
  actionCount: { $lte: acceptedProjectsCounter },
24
- favoriteCount: { $lte: favoriteCount },
25
23
  projectsLiked: { $lte: projectsLiked },
26
24
  projectsCount: { $lte: projectsCount }
27
25
  })
@@ -36,7 +34,6 @@ const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function*
36
34
  const nextRank = yield ranks_model_1.Rank.findOne({
37
35
  $or: [
38
36
  { actionCount: { $gt: acceptedProjectsCounter } },
39
- { favoriteCount: { $gt: favoriteCount } },
40
37
  { projectsLiked: { $gt: projectsLiked } },
41
38
  { projectsCount: { $gt: projectsCount } }
42
39
  ]
@@ -58,10 +55,6 @@ const updateRankForUser = (user) => __awaiter(void 0, void 0, void 0, function*
58
55
  completed: acceptedProjectsCounter - currentRank.actionCount,
59
56
  needed: nextRank.actionCount - currentRank.actionCount
60
57
  },
61
- {
62
- completed: favoriteCount - currentRank.favoriteCount,
63
- needed: nextRank.favoriteCount - currentRank.favoriteCount
64
- },
65
58
  {
66
59
  completed: projectsLiked - currentRank.projectsLiked,
67
60
  needed: nextRank.projectsLiked - currentRank.projectsLiked
@@ -108,5 +108,4 @@ export interface Iuser {
108
108
  haveInvitation: boolean;
109
109
  faceRecognition: string | null;
110
110
  projectsCount: number;
111
- favoriteCount: number;
112
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.228",
3
+ "version": "1.1.229",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [