From a5fe4a1eecca5593d5e22d2392acb56281384037 Mon Sep 17 00:00:00 2001 From: surmon-china Date: Tue, 15 Feb 2022 05:28:52 +0800 Subject: [PATCH] feat: v3.8.1 --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- src/modules/article/article.service.ts | 6 +++--- src/modules/comment/comment.service.ts | 2 +- src/modules/option/option.service.ts | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10845194..5027c3c1 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. +### 3.8.1 (2022-02-15) + +**BugFix** + +- fix `{ timestamps: false }` for + - `article.meta.views` + - `article.meta.likes` + - `article.meta.comments` + - `comment.vote` + - `option.meta.likes` + ### 3.8.0 (2022-02-14) **Feature** diff --git a/package.json b/package.json index 04796356..b2e910d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodepress", - "version": "3.8.0", + "version": "3.8.1", "description": "RESTful API service for Surmon.me blog", "author": { "name": "Surmon", diff --git a/src/modules/article/article.service.ts b/src/modules/article/article.service.ts index 2d68dc3e..83e01c40 100755 --- a/src/modules/article/article.service.ts +++ b/src/modules/article/article.service.ts @@ -119,7 +119,7 @@ export class ArticleService { // article views article.meta.views++ - article.save() + article.save({ timestamps: false }) // global today views this.cacheService.get(CACHE_KEY.TODAY_VIEWS).then((views) => { @@ -135,7 +135,7 @@ export class ArticleService { publicOnly: true, }) article.meta.likes++ - await article.save() + await article.save({ timestamps: false }) return article.meta.likes } @@ -241,6 +241,6 @@ export class ArticleService { public async updateMetaComments(articleID: number, commentCount: number) { const findParams = { id: articleID } const patchParams = { $set: { 'meta.comments': commentCount } } - return this.articleModel.updateOne(findParams, patchParams).exec() + return this.articleModel.updateOne(findParams, patchParams, { timestamps: false }).exec() } } diff --git a/src/modules/comment/comment.service.ts b/src/modules/comment/comment.service.ts index 34ab7383..ea1bee92 100755 --- a/src/modules/comment/comment.service.ts +++ b/src/modules/comment/comment.service.ts @@ -317,7 +317,7 @@ export class CommentService { public async vote(commentID: number, isLike: boolean) { const comment = await this.getDetailByNumberID(commentID) isLike ? comment.likes++ : comment.dislikes++ - await comment.save() + await comment.save({ timestamps: false }) return { likes: comment.likes, dislikes: comment.dislikes, diff --git a/src/modules/option/option.service.ts b/src/modules/option/option.service.ts index d4ffacac..24e9f9ff 100755 --- a/src/modules/option/option.service.ts +++ b/src/modules/option/option.service.ts @@ -73,7 +73,7 @@ export class OptionService { public async incrementLikes(): Promise { const option = await this.ensureAppOption() option.meta.likes++ - await option.save() + await option.save({ timestamps: false }) await this.optionCache.update() return option.meta.likes }