-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/46 봉사 모집글 삭제, 상태 변경 기능 #48
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
Merged
leebs0521
merged 8 commits into
main
from
feature/46-add-recruit-board-modify-status-and-delete
Nov 26, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3fbdcef
feat(recruit-board): 봉사 모집글 삭제 기능
leebs0521 226e69d
test(recruit-board): 봉사 모집글 삭제 기능 테스트
leebs0521 c74c1a8
refactor: 불필요한 접근 제어자 제거
leebs0521 c6f588e
feat(recruit-board): 모집글 상태 변경 기능
leebs0521 491c05d
test(recruit-board): 모집글 상태 변경 기능 테스트
leebs0521 da5bf95
refactor: 중복 코드 제거
leebs0521 e791ae3
refactor(recruit-board): 메서드명 변경
leebs0521 4c01e4e
refactor(recruit-board): RecruitBoard 상태 변경 검증 내부 로직 수정
leebs0521 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
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
42 changes: 42 additions & 0 deletions
42
src/main/java/com/somemore/recruitboard/service/command/DeleteRecruitBoardService.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.somemore.recruitboard.service.command; | ||
|
|
||
| import static com.somemore.global.exception.ExceptionMessage.NOT_EXISTS_RECRUIT_BOARD; | ||
| import static com.somemore.global.exception.ExceptionMessage.UNAUTHORIZED_RECRUIT_BOARD; | ||
|
|
||
| import com.somemore.global.exception.BadRequestException; | ||
| import com.somemore.global.exception.ExceptionMessage; | ||
| import com.somemore.recruitboard.domain.RecruitBoard; | ||
| import com.somemore.recruitboard.repository.RecruitBoardRepository; | ||
| import com.somemore.recruitboard.usecase.command.DeleteRecruitBoardUseCase; | ||
| import java.util.UUID; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| @RequiredArgsConstructor | ||
| @Transactional | ||
| @Service | ||
| public class DeleteRecruitBoardService implements DeleteRecruitBoardUseCase { | ||
|
|
||
| private final RecruitBoardRepository recruitBoardRepository; | ||
|
|
||
| @Override | ||
| public void deleteRecruitBoard(UUID centerId, Long recruitBoardId) { | ||
| RecruitBoard recruitBoard = recruitBoardRepository.findById(recruitBoardId).orElseThrow( | ||
| () -> new BadRequestException(NOT_EXISTS_RECRUIT_BOARD.getMessage()) | ||
| ); | ||
|
|
||
| validateWriter(recruitBoard, centerId); | ||
|
|
||
| recruitBoard.markAsDeleted(); | ||
| recruitBoardRepository.save(recruitBoard); | ||
| } | ||
|
|
||
| private void validateWriter(RecruitBoard recruitBoard, UUID centerId) { | ||
| if (recruitBoard.isWriter(centerId)) { | ||
| return; | ||
| } | ||
|
|
||
| throw new BadRequestException(UNAUTHORIZED_RECRUIT_BOARD.getMessage()); | ||
| } | ||
| } | ||
This file contains hidden or 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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/somemore/recruitboard/usecase/command/DeleteRecruitBoardUseCase.java
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.somemore.recruitboard.usecase.command; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| public interface DeleteRecruitBoardUseCase { | ||
|
|
||
| void deleteRecruitBoard(UUID centerId, Long recruitBoardId); | ||
| } |
13 changes: 11 additions & 2 deletions
13
src/main/java/com/somemore/recruitboard/usecase/command/UpdateRecruitBoardUseCase.java
This file contains hidden or 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,22 +1,31 @@ | ||
| package com.somemore.recruitboard.usecase.command; | ||
|
|
||
| import com.somemore.recruitboard.domain.RecruitStatus; | ||
| import com.somemore.recruitboard.dto.request.RecruitBoardLocationUpdateRequestDto; | ||
| import com.somemore.recruitboard.dto.request.RecruitBoardUpdateRequestDto; | ||
| import java.time.LocalDateTime; | ||
| import java.util.UUID; | ||
|
|
||
| public interface UpdateRecruitBoardUseCase { | ||
|
|
||
| public void updateRecruitBoard( | ||
| void updateRecruitBoard( | ||
| RecruitBoardUpdateRequestDto requestDto, | ||
| Long recruitBoardId, | ||
| UUID centerId, | ||
| String imgUrl | ||
| ); | ||
|
|
||
| public void updateRecruitBoardLocation( | ||
| void updateRecruitBoardLocation( | ||
| RecruitBoardLocationUpdateRequestDto requestDto, | ||
| Long recruitBoardId, | ||
| UUID centerId | ||
| ); | ||
|
|
||
| void updateRecruitBoardStatus( | ||
| RecruitStatus status, | ||
| Long recruitBoardId, | ||
| UUID centerId, | ||
| LocalDateTime currentDateTime | ||
| ); | ||
|
|
||
| } |
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.