Skip to content

Commit 7870f36

Browse files
committed
⚡ MarkSphere v1.0.10
입력 데이터 검증 로직 개선(dto에서 1차적으로 검증. 이후, DB에서 검증)
1 parent c8c41a1 commit 7870f36

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/com/sonkim/bookmarking/domain/category/service/CategoryService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,17 @@ public void updateCategoryPositions(Long userId, Long teamId, List<CategoryDto.U
148148
// 각 카테고리의 position 값 업데이트
149149
for (CategoryDto.UpdatePositionRequestDto request : requests) {
150150
Category category = categoryMap.get(request.getCategoryId());
151+
152+
if (category == null) {
153+
throw new EntityNotFoundException("해당 카테고리를 찾을 수 없습니다. categoryId:" + request.getCategoryId());
154+
}
155+
151156
category.updatePosition(request.getPosition());
152157
}
153158
}
154159

155160
public Category getCategoryById(Long categoryId) {
156161
return categoryRepository.findById(categoryId)
157-
.orElseThrow(() -> new EntityNotFoundException("해당 카테고리를 찾을 수 없습니다."));
162+
.orElseThrow(() -> new EntityNotFoundException("해당 카테고리를 찾을 수 없습니다. categoryId:" + categoryId));
158163
}
159164
}

0 commit comments

Comments
 (0)