Skip to content

Commit

Permalink
Refactor/#58 diary content api exception retry (#61)
Browse files Browse the repository at this point in the history
* refactor:content api에서 advice와 feeling값 null값허용

* diary엔티티 content칼럼 Longtext로수정및 slowtype api 이미지파일없어도가능하게
  • Loading branch information
jms0324 authored May 9, 2024
1 parent e62b550 commit b2fb077
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public class Advice {
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "LONGTEXT")
String kind_advice;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "LONGTEXT")
String spicy_advice;

public Advice(String kind_advice, String spicy_advice) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Diary extends BaseTimeEntity {
private Feeling feeling;


@Column(nullable = false,columnDefinition = "TEXT")
@Column(nullable = false,columnDefinition = "LONGTEXT")
private String content;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ public ResponseEntity<ApiResponse<?>> createSlowTypeDiary(@RequestHeader(value =
if (authHeader != null && authHeader.startsWith("Bearer ")) {
accessToken = authHeader.substring(7);
}
String imageUrl = s3UploaderService.upload(image);
String imageUrl=null;

if(image!=null && !image.isEmpty() ){
imageUrl = s3UploaderService.upload(image);

}

Long memberId= jwtProvider.getUserFromJwt(accessToken);
Member member= memberService.findByIdOrThrow(memberId);
Diary diary = new Diary();
Expand All @@ -225,7 +231,7 @@ public ResponseEntity<ApiResponse<?>> createSlowTypeDiary(@RequestHeader(value =
System.out.println(LocalDateTime.now());
diary.setWritedAt(LocalDateTime.now()); //이부분추가
System.out.println(diary.getWritedAt());
diary.setImageurl(imageUrl);
diary.setImageurl(imageUrl);

Diary savedDiary=diaryService.saveDiary(diary);
SlowTypeCreateResponseDto responseDto=new SlowTypeCreateResponseDto(diary.getId(),diary.getContent(),diary.getTitle(),diary.getImageurl());
Expand Down

0 comments on commit b2fb077

Please sign in to comment.