Skip to content

Commit

Permalink
feat: v3.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Feb 14, 2022
1 parent f51592a commit a5fe4a1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/modules/article/article.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class ArticleService {

// article views
article.meta.views++
article.save()
article.save({ timestamps: false })

// global today views
this.cacheService.get<number>(CACHE_KEY.TODAY_VIEWS).then((views) => {
Expand All @@ -135,7 +135,7 @@ export class ArticleService {
publicOnly: true,
})
article.meta.likes++
await article.save()
await article.save({ timestamps: false })
return article.meta.likes
}

Expand Down Expand Up @@ -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()
}
}
2 changes: 1 addition & 1 deletion src/modules/comment/comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/option/option.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class OptionService {
public async incrementLikes(): Promise<number> {
const option = await this.ensureAppOption()
option.meta.likes++
await option.save()
await option.save({ timestamps: false })
await this.optionCache.update()
return option.meta.likes
}
Expand Down

0 comments on commit a5fe4a1

Please sign in to comment.