Skip to content

Commit

Permalink
fix: use upsert for updateReviewRequestLastViewedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj committed Oct 31, 2022
1 parent f6469b7 commit 927116d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/services/review/ReviewRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,12 @@ export default class ReviewRequestService {
const { isomerUserId: userId } = sessionData
const { id: reviewRequestId } = reviewRequest

await this.reviewRequestView.update(
{
lastViewedAt: new Date(),
},
{
where: {
reviewRequestId,
siteId: site.id,
userId,
},
}
)
await this.reviewRequestView.upsert({
reviewRequestId,
siteId: site.id,
userId,
lastViewedAt: new Date(),
})
}

markReviewRequestAsViewed = async (
Expand Down

0 comments on commit 927116d

Please sign in to comment.