@duvdu-v1/duvdu 1.1.162 → 1.1.163
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,7 +6,7 @@ const model_names_1 = require("../types/model-names");
|
|
|
6
6
|
var RefModels;
|
|
7
7
|
(function (RefModels) {
|
|
8
8
|
RefModels["copyright"] = "portfolio-post";
|
|
9
|
-
RefModels["studio"] = "
|
|
9
|
+
RefModels["studio"] = "rentals";
|
|
10
10
|
})(RefModels || (RefModels = {}));
|
|
11
11
|
const projectViewSchema = new mongoose_1.Schema({
|
|
12
12
|
user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
|
|
@@ -26,10 +26,7 @@ const incrementProjectsView = (userId, ref, projectId, lang) => __awaiter(void 0
|
|
|
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
|
-
|
|
30
|
-
if (!update.upsertedId) {
|
|
31
|
-
yield projectViews_model_1.ProjectView.updateOne({ user: userId, project: project._id, date: today }, { $inc: { count: 1 } });
|
|
32
|
-
}
|
|
29
|
+
yield projectViews_model_1.ProjectView.updateOne({ user: userId, project: project._id, date: today }, { $inc: { count: 1 }, $setOnInsert: { ref: ref, date: today } }, { upsert: true });
|
|
33
30
|
}
|
|
34
31
|
catch (error) {
|
|
35
32
|
console.error('Error incrementing projectsView:', error);
|