-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] issue 329: 링크 모음 패지키 이동 리팩토링 #350
Merged
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
f90aa58
refactor: referenceroom 패키지 studyroom 패키지로 이동
verus-j b0a3ec3
refactor: LinkArticle 클래스 이름 수정 및 필드 타입 변경
verus-j a72a3c1
refactor: LinkArticle 컨트롤러, 서비스 클래스명 변경 및 EditingLinkRequest 제거
verus-j 56bffea
refactor: LinkArticle update 메서드 변경
verus-j 5de05b1
refactor: LinkArticle delete 메서드 정리
verus-j 8477653
refactor: LinkNotFoundException 제거
verus-j 66a45f5
refactor: 링크 게시글 조회 관련 서비스 제거
verus-j 970fcb8
test: LinkArticleControllerTest setUp 로직 제거
verus-j 2d360cc
refactor: 링크 게시글 목록 조회 시 Authentication URI에서 제거
verus-j 4d154ca
refactor: Community와 Notice 컨트롤러, 서비스 분리
verus-j 96c6595
refactor: ArticleRepositoryFactory 제거
verus-j 89c0efa
refactor: Article 및 조회 시 인가 기능 제거
verus-j 6347b1e
refactor: NoticeArticle 소프트 delete 적용
verus-j 9fa1459
refactor: CommunityArticle 소프트 delete 적용
verus-j cc91eeb
chore: 충돌 해결
verus-j b24da71
refactor: 사용하지 않는 메서드 정리 및 예외 패키지 이동
verus-j 7b40834
refactor: 사용하지 않는 코드 제거
verus-j 8231c45
refactor: import 문 정리 및 테스트 클래스 default 접근자 설정
verus-j 689fbf6
chore: index.html gitignore 설정
verus-j d736fa4
chore: gitignore 재설정
verus-j 99165a2
chore: 공지 게시글 API 문서화
verus-j 452e356
refactor: 제네릭을 사용한 ArticleService 추출
verus-j 14b3f7f
refactor: CommunityArticle에 제네릭 ArticleService 적용
verus-j 503e38d
refactor: NoticeArticle 제네릭 적용 및 ArticleService 추상화 클래스로 전환
verus-j 547589e
refactor: ArticleRepository 인터페이스 추출
verus-j b3323a5
refactor: Article 추상 클래스로 변경
verus-j 6a0bfda
refactor: LinkArticleDao sql 수정 및 ArticleType 제거
verus-j 907c2e3
test: 테스트 코드 정리
verus-j c450b64
refactor: 커뮤니티 게시글 삭제 URL 수정 및 Article 생성자 접근 제어자 수정
verus-j bba8852
refactor: LinkArticle 관련 테스트 가독성 정리
verus-j 8a16f87
test: CommunityArticle 테스트 가독성 정리
verus-j 5e205cf
test: NoticeArticle 테스트 가독성 정리
verus-j 45afd56
chore: develop 브랜치 충돌 해결
verus-j aedff89
refactor: Article 구조 수정
verus-j 8d94025
refactor: LinkArticle 상속 구조 제거
verus-j 870c641
refactor: NoticeArtice 상속 구조 제거
verus-j 0e4a4de
refactor: CommunityArticle 상속 구조 제거
verus-j 547adcd
refactor: ArticleType을 사용한 구분
verus-j 3f4e9f5
refactor: ArticleType Enum 정리
verus-j ee2e850
refactor: 도메인 패키지 정리
verus-j 81aa170
refactor: 피드백 반영
verus-j 445f0b3
chore: 충돌 해결
verus-j 6bb7d06
refactor: 패키지 정리
verus-j File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor: 피드백 반영
commit 81aa17059ad9f5ba3e948f185b7a7c46b2f2f646
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
import com.woowacourse.moamoa.studyroom.domain.studyroom.StudyRoom; | ||
import com.woowacourse.moamoa.studyroom.domain.link.LinkArticle; | ||
import com.woowacourse.moamoa.studyroom.domain.link.LinkContent; | ||
import com.woowacourse.moamoa.studyroom.domain.exception.ArticleNotFoundException; | ||
import com.woowacourse.moamoa.studyroom.service.exception.ArticleNotFoundException; | ||
import com.woowacourse.moamoa.studyroom.domain.link.repository.LinkArticleRepository; | ||
import com.woowacourse.moamoa.studyroom.domain.studyroom.repository.StudyRoomRepository; | ||
import com.woowacourse.moamoa.studyroom.query.LinkArticleDao; | ||
|
@@ -39,28 +39,28 @@ public LinksResponse getLinks(final Long studyId, final Pageable pageable) { | |
} | ||
|
||
@Transactional | ||
public LinkArticle createArticle(final Long memberId, final Long studyId, final LinkContent content) { | ||
public Long createArticle(final Long memberId, final Long studyId, final LinkContent content) { | ||
final StudyRoom studyRoom = studyRoomRepository.findByStudyId(studyId) | ||
.orElseThrow(() -> new StudyNotFoundException(studyId)); | ||
final LinkArticle article = LinkArticle.create(studyRoom, new Accessor(memberId, studyId), content); | ||
|
||
return linkArticleRepository.save(article); | ||
return linkArticleRepository.save(article).getId(); | ||
} | ||
|
||
@Transactional | ||
public void updateArticle( | ||
final Long memberId, final Long studyId, final Long articleId, final LinkContent newContent | ||
) { | ||
final LinkArticle article = linkArticleRepository.findById(articleId) | ||
.orElseThrow(() -> new ArticleNotFoundException(articleId, LinkArticle.class)); | ||
.orElseThrow(() -> new ArticleNotFoundException(articleId, "LINK")); | ||
|
||
article.update(new Accessor(memberId, studyId), newContent); | ||
} | ||
|
||
@Transactional | ||
public void deleteArticle(final Long memberId, final Long studyId, final Long articleId) { | ||
final LinkArticle article = linkArticleRepository.findById(articleId) | ||
.orElseThrow(() -> new ArticleNotFoundException(articleId, LinkArticle.class)); | ||
.orElseThrow(() -> new ArticleNotFoundException(articleId, "LINK")); | ||
final Accessor accessor = new Accessor(memberId, studyId); | ||
|
||
article.delete(accessor); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 처음 Accessor를 활용할 때는 몰랐는데, 이렇게 보니 Accessor 의 활용도가 굉장히 높네요! |
||
|
6 changes: 3 additions & 3 deletions
6
...n/exception/ArticleNotFoundException.java → ...e/exception/ArticleNotFoundException.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.woowacourse.moamoa.studyroom.domain.exception; | ||
package com.woowacourse.moamoa.studyroom.service.exception; | ||
|
||
import com.woowacourse.moamoa.common.exception.NotFoundException; | ||
|
||
public class ArticleNotFoundException extends NotFoundException { | ||
|
||
public ArticleNotFoundException(final Long articleId, final Class<?> articleType) { | ||
super(String.format("%d의 식별자를 가진 %s 게시글이 존재하지 않습니다.", articleId, articleType.getSimpleName())); | ||
public ArticleNotFoundException(final Long articleId, final String typeName) { | ||
super(String.format("%d의 식별자를 가진 %s 게시글이 존재하지 않습니다.", articleId, typeName)); | ||
} | ||
} |
This file contains 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
Oops, something went wrong.
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.
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.
해당 방법으로 푸니 로직이 훨씬 간결해졌네요 👍