Skip to content

Commit

Permalink
Merge pull request #171 from urinaner/feature/170
Browse files Browse the repository at this point in the history
[BE] 교수, 논문 update 기능에 파일 형식 추가
  • Loading branch information
urinaner authored Nov 24, 2024
2 parents 0246d2e + 199698f commit 5184d16
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public ResponseDto<List<ProfessorResDto>> getAllBoards(Pageable pageable) {
@Operation(summary = "교수 정보 업데이트 API", description = "교수 정보 업데이트")
@PostMapping("/{professorId}")
public ResponseEntity<ProfessorResDto> updateProfessor(@PathVariable(name = "professorId") Long professorId,
@RequestBody ProfessorReqDto professorReqDto) {
ProfessorResDto professorResDto = professorService.updateProfessor(professorId, professorReqDto);
@RequestPart(value = "professorReqDto") ProfessorReqDto professorReqDto,
@RequestPart(value = "profileImage") MultipartFile multipartFile) {
ProfessorResDto professorResDto = professorService.updateProfessor(professorId, professorReqDto, multipartFile);
return new ResponseEntity<>(professorResDto, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public Page<ProfessorResDto> getAllProfessors(Pageable pageable) {
}

@Transactional
public ProfessorResDto updateProfessor(Long professorId, ProfessorReqDto professorReqDto) {
public ProfessorResDto updateProfessor(Long professorId, ProfessorReqDto professorReqDto, MultipartFile multipartFile) {
if (!multipartFile.isEmpty()) {
String uploadImageUrl = s3Uploader.upload(multipartFile, dirName);
professorReqDto.setProfileImage(uploadImageUrl);
}
Professor professor = findProfessorById(professorId);
professor.update(professorReqDto);
return ProfessorResDto.of(professor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public ResponseDto<List<ThesisResDto>> getAllBoards(Pageable pageable) {
@Operation(summary = "논문 정보 업데이트 API", description = "논문 정보 업데이트")
@PostMapping("/{thesisId}")
public ResponseEntity<ThesisResDto> updateThesis(@PathVariable(name = "thesisId") Long thesisId,
@RequestBody ThesisReqDto thesisReqDto) {
ThesisResDto thesisResDto = thesisService.updateThesis(thesisId, thesisReqDto);
@RequestPart(value = "thesisReqDto") ThesisReqDto thesisReqDto,
@RequestPart(value = "thesis_image") MultipartFile multipartFile) {
ThesisResDto thesisResDto = thesisService.updateThesis(thesisId, thesisReqDto, multipartFile);
return new ResponseEntity<>(thesisResDto, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ public Page<ThesisResDto> getAllTheses(Pageable pageable) {
}

@Transactional
public ThesisResDto updateThesis(Long thesisId, ThesisReqDto thesisReqDto) {
public ThesisResDto updateThesis(Long thesisId, ThesisReqDto thesisReqDto, MultipartFile multipartFile) {
if (!multipartFile.isEmpty()) {
String uploadImageUrl = s3Uploader.upload(multipartFile, dirName);
thesisReqDto.setThesisImage(uploadImageUrl);
}

Thesis thesis = findThesisById(thesisId);
Professor professor = findProfessorById(thesisReqDto.getProfessorId());
thesis.update(thesisReqDto, professor);
Expand Down

0 comments on commit 5184d16

Please sign in to comment.