@duvdu-v1/duvdu 1.1.161 → 1.1.162

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.
@@ -1 +1 @@
1
- export declare const incrementProjectsView: (userId: string, projectId: string, lang: string) => Promise<void>;
1
+ export declare const incrementProjectsView: (userId: string, ref: string, projectId: string, lang: string) => Promise<void>;
@@ -14,7 +14,7 @@ const notfound_error_1 = require("../errors/notfound-error");
14
14
  const allProjects_model_1 = require("../models/allProjects.model");
15
15
  const projectViews_model_1 = require("../models/projectViews.model");
16
16
  const User_model_1 = require("../models/User.model");
17
- const incrementProjectsView = (userId, projectId, lang) => __awaiter(void 0, void 0, void 0, function* () {
17
+ const incrementProjectsView = (userId, ref, projectId, lang) => __awaiter(void 0, void 0, void 0, function* () {
18
18
  try {
19
19
  const user = (yield User_model_1.Users.findById(userId));
20
20
  const project = yield allProjects_model_1.Project.findOne({ 'project.type': projectId });
@@ -26,7 +26,7 @@ const incrementProjectsView = (userId, projectId, lang) => __awaiter(void 0, voi
26
26
  throw new notfound_error_1.NotFound({ en: 'project not found', ar: 'لم يتم العثور على المشروع' }, lang);
27
27
  const today = new Date();
28
28
  today.setHours(0, 0, 0, 0);
29
- const update = yield projectViews_model_1.ProjectView.updateOne({ user: userId, project: project._id, date: today }, { $inc: { count: 1 }, $setOnInsert: { ref: project.cycle, date: today } }, { upsert: true });
29
+ const update = yield projectViews_model_1.ProjectView.updateOne({ user: userId, project: project._id, date: today }, { $inc: { count: 1 }, $setOnInsert: { ref: ref, date: today } }, { upsert: true });
30
30
  if (!update.upsertedId) {
31
31
  yield projectViews_model_1.ProjectView.updateOne({ user: userId, project: project._id, date: today }, { $inc: { count: 1 } });
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.161",
3
+ "version": "1.1.162",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [