diff --git a/src/main/java/com/javajober/spaceWall/controller/SpaceWallController.java b/src/main/java/com/javajober/spaceWall/controller/SpaceWallController.java index 710eef69..07648f42 100644 --- a/src/main/java/com/javajober/spaceWall/controller/SpaceWallController.java +++ b/src/main/java/com/javajober/spaceWall/controller/SpaceWallController.java @@ -61,12 +61,12 @@ public ResponseEntity> hasSpace } @GetMapping("/wall/{memberId}/{addSpaceId}/{spaceWallId}") - public ResponseEntity> find ( + public ResponseEntity> find ( @PathVariable final Long memberId, @PathVariable final Long addSpaceId, @PathVariable final Long spaceWallId){ SpaceWallResponse data = spaceWallFindService.find(memberId, addSpaceId, spaceWallId, FlagType.SAVED); - return ResponseEntity.ok(ApiUtils.success(HttpStatus.OK, SuccessMessage.SPACE_WALL_READ_SUCCESS, data)); + return ApiResponse.response(ApiStatus.OK, "공유페이지 조회를 성공했습니다.", data); } @GetMapping("/wall-temporary/{memberId}/{addSpaceId}/{spaceWallId}") @@ -78,12 +78,12 @@ public ResponseEntity> findPending( return ResponseEntity.ok(ApiUtils.success(HttpStatus.OK, SuccessMessage.SPACE_WALL_TEMPORARY_READ_SUCCESS, data)); } - @GetMapping("/wall/{shareURL}") - public ResponseEntity> findByShareURL(@PathVariable final String shareURL) { + @GetMapping("/wall/shareURL/{shareURL}") + public ResponseEntity> findByShareURL(@PathVariable final String shareURL) { SpaceWallResponse data = spaceWallFindService.findByShareURL(shareURL); - return ResponseEntity.ok(ApiUtils.success(HttpStatus.OK, SuccessMessage.SPACE_WALL_READ_SUCCESS, data)); + return ApiResponse.response(ApiStatus.OK, "공유페이지 조회를 성공했습니다.", data); } @GetMapping("/wall/has-duplicate/{shareURL}") diff --git a/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java b/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java index c3bf3b9c..01967eb8 100644 --- a/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java +++ b/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java @@ -1,5 +1,7 @@ package com.javajober.spaceWall.repository; +import com.javajober.exception.ApiStatus; +import com.javajober.exception.ApplicationException; import com.javajober.spaceWall.domain.FlagType; import com.javajober.spaceWall.domain.SpaceWall; import org.springframework.data.jpa.repository.Query; @@ -39,16 +41,16 @@ default List findSpaceWallsOrThrow(final Long memberId, final Long ad default SpaceWall getById(final Long memberId, final Long spaceWallId) { return findSpaceWalls(memberId, spaceWallId).stream() .findFirst() - .orElseThrow(() -> new Exception404(ErrorMessage.ADD_SPACE_NOT_FOUND)); + .orElseThrow(() -> new ApplicationException(ApiStatus.NOT_FOUND, "존재하지 않는 스페이스입니다.")); } default SpaceWall findSpaceWall(Long id, Long addSpaceId, Long memberId, FlagType flag) { return findByIdAndAddSpaceIdAndMemberIdAndFlag(id, addSpaceId, memberId, flag) - .orElseThrow(() -> new Exception404(ErrorMessage.SPACE_WALL_NOT_FOUND)); + .orElseThrow(() -> new ApplicationException(ApiStatus.NOT_FOUND, "공유페이지를 찾을 수 없습니다.")); } default SpaceWall getByShareURL(final String shareURL) { return findByShareURL(shareURL) - .orElseThrow(() -> new Exception404(ErrorMessage.SHARE_URL_NOT_FOUND)); + .orElseThrow(() -> new ApplicationException(ApiStatus.NOT_FOUND, "존재하지 않은 share url입니다.")); } } \ No newline at end of file