-
Notifications
You must be signed in to change notification settings - Fork 4
CLAP-166 feat:회원 삭제 API 구현 #159
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
26 changes: 26 additions & 0 deletions
26
src/main/java/clap/server/adapter/inbound/web/admin/DeleteMemberController.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,26 @@ | ||
| package clap.server.adapter.inbound.web.admin; | ||
|
|
||
| import clap.server.application.port.inbound.admin.DeleteMemberUsecase; | ||
| import clap.server.common.annotation.architecture.WebAdapter; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.security.access.annotation.Secured; | ||
| import org.springframework.web.bind.annotation.PatchMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
|
|
||
| @Tag(name = "05. Admin") | ||
| @WebAdapter | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/api/managements") | ||
| public class DeleteMemberController { | ||
| private final DeleteMemberUsecase deleteMemberUsecase; | ||
|
|
||
| @Operation(summary = "회원 삭제 API") | ||
| @Secured("ROLE_ADMIN") | ||
| @PatchMapping("/members/{memberId}") | ||
| public void deleteMember(@PathVariable Long memberId) { | ||
| deleteMemberUsecase.deleteMember(memberId); | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
src/main/java/clap/server/application/port/inbound/admin/DeleteMemberUsecase.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,5 @@ | ||
| package clap.server.application.port.inbound.admin; | ||
|
|
||
| public interface DeleteMemberUsecase { | ||
| void deleteMember(Long memberId); | ||
| } |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/clap/server/application/service/admin/DeleteMemberService.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,28 @@ | ||
| package clap.server.application.service.admin; | ||
|
|
||
| import clap.server.application.port.inbound.admin.DeleteMemberUsecase; | ||
| import clap.server.application.port.inbound.domain.MemberService; | ||
| import clap.server.application.port.outbound.member.CommandMemberPort; | ||
| import clap.server.application.port.outbound.member.LoadMemberPort; | ||
| import clap.server.domain.model.member.Member; | ||
| import clap.server.exception.ApplicationException; | ||
| import clap.server.exception.code.MemberErrorCode; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class DeleteMemberService implements DeleteMemberUsecase { | ||
| private final LoadMemberPort loadMemberPort; // 조회 작업용 Port | ||
| private final CommandMemberPort commandMemberPort; // 데이터 변경 작업용 Port | ||
|
|
||
| @Override | ||
| public void deleteMember(Long memberId) { | ||
| Member member = loadMemberPort.findById(memberId) | ||
| .orElseThrow(() -> new ApplicationException(MemberErrorCode.MEMBER_NOT_FOUND)); | ||
|
|
||
| member.setStatusDeleted(); | ||
|
|
||
| commandMemberPort.save(member); | ||
| } | ||
| } |
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
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.