Skip to content

Commit

Permalink
[REFACTOR] 커뮤니티 게시글 등록 시 이미지 여부 선택값으로 수정 (#27)
Browse files Browse the repository at this point in the history
* [REFACTOR] 필수값 제외 및 주석 추가

* [REFACTOR] 서버 에러 발생 시 응답 메시지 수정
  • Loading branch information
kyukong authored Feb 28, 2024
1 parent 622b954 commit 4d603d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
import com.oya.kr.global.dto.response.ApplicationResponse;

import lombok.RequiredArgsConstructor;
import lombok.extern.java.Log;

/**
* @author 이상민
* @since 2024.02.17
*/
@Log
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/communities")
Expand All @@ -47,8 +49,11 @@ public class CommunityController {
public ResponseEntity<ApplicationResponse<String>> save(
Principal principal,
@RequestPart("data") CommunityRequest communityRequest,
@RequestPart("images") List<MultipartFile> images,
@RequestPart(value = "images", required = false) List<MultipartFile> images,
@RequestParam("type") String communityType) {
log.info(communityRequest.toString());
log.info(images.toString());
log.info(communityType);
return ResponseEntity.ok(ApplicationResponse.success(communityService.save(communityType, principal.getName(), communityRequest, images)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public ResponseEntity<ApplicationResponse<Void>> handleValidationException(Metho
@ExceptionHandler(Exception.class)
public ResponseEntity<ApplicationResponse<Void>> handleGlobalException(Exception e) {
log.info(e.getMessage());
ApplicationResponse<Void> response = ApplicationResponse.fail(INTERNAL_SERVER_ERROR_CODE,
"서버에 문제가 발생하였습니다. 관리자에게 문의해주세요.");
ApplicationResponse<Void> response = ApplicationResponse.fail(INTERNAL_SERVER_ERROR_CODE, e.getMessage());
return ResponseEntity.badRequest().body(response);
}
}

0 comments on commit 4d603d5

Please sign in to comment.