-
Notifications
You must be signed in to change notification settings - Fork 7
[BE] refactor: 파서 및 렌더러 빈 등록, Writing과 Block 일대다 단방향 적용 #368
[BE] refactor: 파서 및 렌더러 빈 등록, Writing과 Block 일대다 단방향 적용 #368
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.
꽤나 여러군데에 수정사항이 생겼을텐데 수정하느라 고생했어요!~ 깔끔하네요!
@@ -24,6 +25,7 @@ public interface WritingRepository extends JpaRepository<Writing, Long> { | |||
"where w.nextWriting.id = :writingId") | |||
Optional<Writing> findPreWritingByWritingId(@Param("writingId") final Long writingId); | |||
|
|||
@EntityGraph(attributePaths = "blocks") |
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.
해당 메서드를 사용하는데 blocks를 가져올 필요 없는 부분들에서도 사용되는 것 같아요! (글 제목 변경, 글 순서 변경 등). 메서드를 분리해서 가져오는게 좋을 것 같습니다
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.
그렇네요! ㅎㅎㅎ findByIdWithBlocks
로 메서드 명을 변경하였고, Writing
을 가져올 때에 Blocks
정보가 필요 없는 것들은 기본 메서드인 findById
를 호출하도록 수정하였습니다!
|
||
public Long uploadMarkDownFile(final Long memberId, final MarkdownUploadRequest request) throws IOException { | ||
final String originalFilename = request.file().getOriginalFilename(); | ||
if (!Objects.requireNonNull(originalFilename).endsWith(MD_FORMAT)) { | ||
throw new InvalidFileFormatException(originalFilename); | ||
} | ||
final String originalFileText = new String(request.file().getBytes(), StandardCharsets.UTF_8); | ||
final List<Block> blocks = markDownParser.parse(originalFileText); |
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.
캬 깔끔하네요. 이제야 파서다워진 느낌입니다.
@@ -32,7 +33,6 @@ public class MarkDownParser { | |||
private static final int SPACE_GROUP_INDEX = 2; | |||
|
|||
private final MarkDownStyleParser markDownStyleParser; | |||
private final Writing writing; |
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.
멋지네요 ㅜㅜ
public Block(final Long id, final Writing writing, final Depth depth, final BlockType blockType) { | ||
this.id = id; | ||
this.writing = writing; | ||
public Block(final Depth depth, final BlockType blockType) { |
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.
좋네요!
@@ -41,26 +47,34 @@ public class Writing extends BaseEntity { | |||
@ManyToOne(fetch = FetchType.LAZY) | |||
@JoinColumn(name = "category_id") | |||
private Category category; | |||
@OneToMany(cascade = CascadeType.PERSIST) |
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.
깔끔합니다.. ㅜㅜ
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.
멋져요 👍
* refactor: Writing에서 Block에 대한 일대다 단방향에 대한 수정과, 각 파서들을 빈으로 등록 * refactor: 렌더러 빈 등록 * refactor: 스프링 부트 테스트를 단위테스트로 수정 및 코드 스타일 수정 * refactor: 주석 제거 * feat: Writing 페치 조인 쿼리 분리 및 WritingNotFoundException 서비스에서 관리
* refactor: Writing에서 Block에 대한 일대다 단방향에 대한 수정과, 각 파서들을 빈으로 등록 * refactor: 렌더러 빈 등록 * refactor: 스프링 부트 테스트를 단위테스트로 수정 및 코드 스타일 수정 * refactor: 주석 제거 * feat: Writing 페치 조인 쿼리 분리 및 WritingNotFoundException 서비스에서 관리
🛠️ Issue
✅ Tasks
⏰ Time Difference
📝 Note