Skip to content

Commit

Permalink
refactor(repository): sourceCodeRepository.deleteAllByTemplateIds 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
kyum-q committed Oct 15, 2024
1 parent 2a04042 commit 0ccc90a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ default SourceCode fetchByTemplateAndOrdinal(Template template, int ordinal) {

@Modifying(clearAutomatically = true)
@Query("DELETE FROM SourceCode s WHERE s.template.id in :templateIds")
void deleteByTemplateIds(List<Long> templateIds);
void deleteAllByTemplateIds(List<Long> templateIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ public interface SourceCodeRepository {

void deleteById(Long id);

void deleteByTemplateIds(List<Long> templateIds);
void deleteAllByTemplateIds(List<Long> templateIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ private void validateSourceCodesCount(Template template, UpdateTemplateRequest u

@Transactional
public void deleteAllByTemplateIds(List<Long> templateIds) {
sourceCodeRepository.deleteByTemplateIds(templateIds);
sourceCodeRepository.deleteAllByTemplateIds(templateIds);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void deleteById(Long id) {
}

@Override
public void deleteByTemplateIds(List<Long> templateIds) {
public void deleteAllByTemplateIds(List<Long> templateIds) {
templateIds.forEach(id ->
sourceCodes.removeIf(sourceCode -> Objects.equals(sourceCode.getId(), id)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void testDeleteByTemplateId() {
sut.save(new SourceCode(template1, "SourceCode 2", "Content 2", 2));
sut.save(new SourceCode(template2, "SourceCode 3", "Content 3", 1));

sut.deleteByTemplateIds(List.of(1L));
sut.deleteAllByTemplateIds(List.of(1L));
var result = sut.findAllByTemplate(template1);

assertThat(result).isEmpty();
Expand Down

0 comments on commit 0ccc90a

Please sign in to comment.