-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* refactor: 어드민 모듈 스웨거 controller 분리 * refactor: api 모듈 스웨거 controller 분리 * refactor: 관리자 사용자 스웨거 간 접근 개선 * fix: 잘못된 메서드명 수정 Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: 잘못된 메서드명 수정 Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: 잘못된 메서드명 수정 * refactor: 테스트 커버리지 통과율 임시로 10%로 설정 --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ae2adbd
commit f46289c
Showing
46 changed files
with
1,213 additions
and
555 deletions.
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
58 changes: 25 additions & 33 deletions
58
aics-admin/src/main/java/kgu/developers/admin/about/presentation/AboutAdminController.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,60 +1,52 @@ | ||
package kgu.developers.admin.about.presentation; | ||
|
||
import static org.springframework.http.HttpStatus.CREATED; | ||
import static org.springframework.http.HttpStatus.NO_CONTENT; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import kgu.developers.admin.about.application.AboutAdminFacade; | ||
import kgu.developers.admin.about.presentation.request.AboutRequest; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.Positive; | ||
import kgu.developers.admin.about.presentation.request.AboutCreateRequest; | ||
import kgu.developers.admin.about.presentation.request.AboutUpdateRequest; | ||
import kgu.developers.admin.about.presentation.response.AboutPersistResponse; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/abouts") | ||
@PreAuthorize("hasRole('ROLE_ADMIN')") | ||
@Tag(name = "About", description = "소개글 관리자 API") | ||
public class AboutAdminController { | ||
private final AboutAdminFacade aboutAdminFacade; | ||
public interface AboutAdminController { | ||
|
||
@Operation(summary = "소개글 생성 API", description = """ | ||
- Description : 이 API는 소개글을 생성합니다. | ||
- Assignee : 이신행 | ||
""") | ||
@ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = AboutPersistResponse.class))) | ||
@PostMapping | ||
public ResponseEntity<AboutPersistResponse> createAbout( | ||
@RequestBody AboutRequest request | ||
) { | ||
AboutPersistResponse response = aboutAdminFacade.createAbout(request); | ||
return ResponseEntity.status(CREATED).body(response); | ||
} | ||
@ApiResponse( | ||
responseCode = "201", | ||
content = @Content(schema = @Schema(implementation = AboutPersistResponse.class))) | ||
ResponseEntity<AboutPersistResponse> createAbout( | ||
@Parameter( | ||
description = "소개글 생성 request 객체 입니다.", | ||
required = true | ||
) @Valid @RequestBody AboutCreateRequest request | ||
); | ||
|
||
@Operation(summary = "소개글 수정 API", description = """ | ||
- Description : 이 API는 소개글을 수정합니다. | ||
- Assignee : 이신행 | ||
""") | ||
@ApiResponse(responseCode = "204") | ||
@PatchMapping("/{id}") | ||
public ResponseEntity<Void> updateAbout( | ||
@PathVariable Long id, | ||
@RequestBody AboutUpdateRequest request | ||
) { | ||
aboutAdminFacade.updateAbout(id, request); | ||
return ResponseEntity.status(NO_CONTENT).build(); | ||
} | ||
ResponseEntity<Void> updateAbout( | ||
@Parameter( | ||
description = "소개글 ID는 URL 경로 변수 입니다.", | ||
example = "1", | ||
required = true | ||
) @Positive @PathVariable Long id, | ||
@Parameter( | ||
description = "소개글 수정 request 객체 입니다.", | ||
required = true | ||
) @Valid @RequestBody AboutUpdateRequest request | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
...admin/src/main/java/kgu/developers/admin/about/presentation/AboutAdminControllerImpl.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package kgu.developers.admin.about.presentation; | ||
|
||
import static org.springframework.http.HttpStatus.CREATED; | ||
import static org.springframework.http.HttpStatus.NO_CONTENT; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.Positive; | ||
import kgu.developers.admin.about.application.AboutAdminFacade; | ||
import kgu.developers.admin.about.presentation.request.AboutCreateRequest; | ||
import kgu.developers.admin.about.presentation.request.AboutUpdateRequest; | ||
import kgu.developers.admin.about.presentation.response.AboutPersistResponse; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/abouts") | ||
@PreAuthorize("hasRole('ROLE_ADMIN')") | ||
public class AboutAdminControllerImpl implements AboutAdminController { | ||
private final AboutAdminFacade aboutAdminFacade; | ||
|
||
@Override | ||
@PostMapping | ||
public ResponseEntity<AboutPersistResponse> createAbout( | ||
@Valid @RequestBody AboutCreateRequest request | ||
) { | ||
AboutPersistResponse response = aboutAdminFacade.createAbout(request); | ||
return ResponseEntity.status(CREATED).body(response); | ||
} | ||
|
||
@Override | ||
@PatchMapping("/{id}") | ||
public ResponseEntity<Void> updateAbout( | ||
@Positive @PathVariable Long id, | ||
@Valid @RequestBody AboutUpdateRequest request | ||
) { | ||
aboutAdminFacade.updateAbout(id, request); | ||
return ResponseEntity.status(NO_CONTENT).build(); | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
aics-admin/src/main/java/kgu/developers/admin/club/presentation/ClubAdminControllerImpl.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package kgu.developers.admin.club.presentation; | ||
|
||
import static org.springframework.http.HttpStatus.CREATED; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.Positive; | ||
import kgu.developers.admin.club.application.ClubAdminFacade; | ||
import kgu.developers.admin.club.presentation.request.ClubRequest; | ||
import kgu.developers.admin.club.presentation.response.ClubPersistResponse; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/clubs") | ||
@PreAuthorize("hasRole('ROLE_ADMIN')") | ||
public class ClubAdminControllerImpl implements ClubAdminController { | ||
private final ClubAdminFacade clubAdminFacade; | ||
|
||
@Override | ||
@PostMapping | ||
public ResponseEntity<ClubPersistResponse> createClub( | ||
@Valid @RequestBody ClubRequest request | ||
) { | ||
ClubPersistResponse response = clubAdminFacade.createClub(request); | ||
return ResponseEntity.status(CREATED).body(response); | ||
} | ||
|
||
@Override | ||
@PatchMapping("/{id}") | ||
public ResponseEntity<Void> updateClub( | ||
@Positive @PathVariable Long id, | ||
@Valid @RequestBody ClubRequest request | ||
) { | ||
clubAdminFacade.updateClub(id, request); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
|
||
@Override | ||
@DeleteMapping("/{id}") | ||
public ResponseEntity<Void> deleteClub( | ||
@Positive @PathVariable Long id | ||
) { | ||
clubAdminFacade.deleteClub(id); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
} |
13 changes: 1 addition & 12 deletions
13
...admin/src/main/java/kgu/developers/admin/comment/presentation/CommentAdminController.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,20 +1,9 @@ | ||
package kgu.developers.admin.comment.presentation; | ||
|
||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import kgu.developers.admin.comment.application.CommentAdminFacade; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/comments") | ||
@PreAuthorize("hasRole('ROLE_ADMIN')") | ||
@Tag(name = "Comment", description = "댓글 관리자 API") | ||
public class CommentAdminController { | ||
private final CommentAdminFacade commentAdminFacade; | ||
public interface CommentAdminController { | ||
|
||
// TODO : 관리자 권한 댓글 삭제 API 구현 | ||
} |
16 changes: 16 additions & 0 deletions
16
...n/src/main/java/kgu/developers/admin/comment/presentation/CommentAdminControllerImpl.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kgu.developers.admin.comment.presentation; | ||
|
||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import kgu.developers.admin.comment.application.CommentAdminFacade; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/comments") | ||
@PreAuthorize("hasRole('ROLE_ADMIN')") | ||
public class CommentAdminControllerImpl implements CommentAdminController { | ||
private final CommentAdminFacade commentAdminFacade; | ||
} |
Oops, something went wrong.