PostingController의 getAttachList() 메서드가 Entity를 반환하는 문제를 해결한다.
gusah009 opened this issue · comments
정핸모 commented
사전 수행 issue
없음.
이슈 내용
@GetMapping(value = "/attach/{pid}")
public ListResult<FileEntity> getAttachList(@PathVariable("pid") Long postingId) {
return responseService.getSuccessListResult(
fileService.findAllByPostingId(postingService.getPostingById(postingId)));
}
위 코드는 PostingController
에서 특정 포스팅의 첨부파일 목록을 모두 가져오는 코드입니다.
하지만 Entity가 클라이언트에게 곧바로 노출되어 있어 API 유지보수시에 문제가 발생할 가능성이 높습니다.
따라서 FileEntity
대신 관련 정보를 담은 Dto
를 생성해서 반환해야 할 것 같습니다.
-
FileEntity
대신 관련 정보를 담은Dto
를 반환하도록 변경- ❗️ 해당 작업 수행 과정에서 응답 데이터 형식이나 url이 변경된다면 반드시 프론트엔드에 알리고 함께 수정할 것!!