-
Notifications
You must be signed in to change notification settings - Fork 0
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
비디오 조회수 증가 #153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeId valid체크도 있었네요 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 안하고 findOneUpdate에 바로 넣으면 ObjectId가 아니라는 오류가 뜨더라구요! 🥲
resolved: #152
작업 내용