Skip to content

Commit

Permalink
refactor: TagsResponse 생성자 대신 정적 팩토리 메서드를 사용하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Go-Jaecheol committed Jul 27, 2023
1 parent 65b3d7f commit a9e91b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private void getTagsByTagType(final List<TagsResponse> responses, final TagType
final List<TagDto> tags = tagRepository.findTagsByTagType(tagType).stream()
.map(TagDto::toDto)
.collect(Collectors.toList());
final TagsResponse tagsResponse = new TagsResponse(tagType.name(), tags);
final TagsResponse tagsResponse = TagsResponse.toResponse(tagType.name(), tags);
responses.add(tagsResponse);
}
}
4 changes: 4 additions & 0 deletions backend/src/main/java/com/funeat/tag/dto/TagsResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public TagsResponse(final String tagType, final List<TagDto> tags) {
this.tags = tags;
}

public static TagsResponse toResponse(final String tagType, final List<TagDto> tags) {
return new TagsResponse(tagType, tags);
}

public String getTagType() {
return tagType;
}
Expand Down

0 comments on commit a9e91b8

Please sign in to comment.