Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

비디오 조회수 증가 #153

Merged
merged 3 commits into from
Nov 30, 2023
Merged

비디오 조회수 증가 #153

merged 3 commits into from
Nov 30, 2023

Conversation

5tarry
Copy link
Collaborator

@5tarry 5tarry commented Nov 30, 2023

resolved: #152

작업 내용

  • 조회수 증가 API
  • 기존 비디오 응답 manifest 수정

@5tarry 5tarry added backend feat 새로운 기능 추가 labels Nov 30, 2023
@5tarry 5tarry added this to the Week 4 milestone Nov 30, 2023
@5tarry 5tarry requested a review from msjang4 November 30, 2023 05:23
@5tarry 5tarry self-assigned this Nov 30, 2023
Copy link
Collaborator

@msjang4 msjang4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment on lines +29 to +36
await this.VideoModel.findOneAndUpdate(
{ _id: videoId },
{ $inc: { viewCount: 1 } },
{ new: true },
)
.session(session)
.then((result) => {
if (result.modifiedCount === 0) {
throw new VideoNotFoundException();
}
if (!result) throw new VideoNotFoundException();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findOneAndUpdate로 처리하신거 좋네요!

userId: string,
seed: number,
): Promise<ViewResponseDto> {
if (!Types.ObjectId.isValid(videoId)) throw new VideoNotFoundException();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeId valid체크도 있었네요 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 안하고 findOneUpdate에 바로 넣으면 ObjectId가 아니라는 오류가 뜨더라구요! 🥲

@msjang4 msjang4 merged commit 7210b78 into develop Nov 30, 2023
@5tarry 5tarry deleted the feat/view_video_api branch December 8, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend feat 새로운 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Backend] 비디오 조회수 증가
2 participants