Merged
Conversation
src/modules/problem/service.ts
Outdated
|
|
||
| for (const problem of response['items']) { | ||
| problems.push(new Problem(problem)); | ||
| problems.push(problem); |
There was a problem hiding this comment.
Removing the instantiation (i.e., new Problem(problem)) may lead to inconsistent behavior if consumers expect an instance with methods defined on the Problem class. Consider converting the raw problem object to a Problem instance using Problem.fromDocument or the appropriate constructor.
Suggested change
| problems.push(problem); | |
| problems.push(new Problem(problem)); |
| validate(id: string, poker: Poker): void { | ||
| if (!poker) { | ||
| async update(id: string, poker: Poker): Promise<Poker> { | ||
| const pokerDoc = await this.pokerModel.findByIdAndUpdate(id, poker); |
There was a problem hiding this comment.
findByIdAndUpdate by default returns the pre-update document. Consider adding the option { new: true } to return the updated document, ensuring that Poker.fromDocument reflects the latest changes.
Suggested change
| const pokerDoc = await this.pokerModel.findByIdAndUpdate(id, poker); | |
| const pokerDoc = await this.pokerModel.findByIdAndUpdate(id, poker, { new: true }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
업데이트 유형
업데이트 개요
엔티티 구조가 완전하지 않았음
해당 구조 리팩터링에 집중
업데이트 요약
수정 사항 진단