Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ public ResponseEntity<List<CommunityResponse>> getCommunities(@RequestParam(defa
List<CommunityResponse> communities = communityService.getCommunitiesByLikeCount(sortOrder);
return ResponseEntity.ok(communities);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
@Tag(name = "Community API", description = "커뮤니티에 올리는 게시글을 생성, 조회합니다.")
public interface CommunityControllerDocs {

@Operation(summary = "ChatGPT 검사 API", description = "게시물 작성 후 ChatGPT API를 활용해 글 내용을 세련되게 변경합니다.")
@Operation(summary = "ChatGPT 검사 API(검토용)", description = "ChatGPT API를 활용해 글 내용을 변환하는 과정입니다. 프론트 쪽에서 적용 X")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "글 내용 수정 완료"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
})
ResponseEntity<CommunityResponse> checkContent(@RequestPart CommunityRequest communityRequest,
@RequestPart(value = "image", required = false) MultipartFile image);

@Operation(summary = "커뮤니티 글 저장", description = "ChatGPT 검사 후 최종적으로 글을 저장합니다.")
@Operation(summary = "ChatGPT 검사 API", description = "최종적으로 ChatGPT API를 활용해 글 내용을 세련되게 변경해 저장합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "글 저장 성공"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.likelion.bizup.global.enums.Region;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

Expand All @@ -18,9 +19,21 @@ public class CommunityMainResponse {
@Schema(description = "커뮤니티 글 제목", example = "전통시장")
private String title;

@Schema(description = "커뮤니티 글 내용", example = "sample")
private String content;

@Schema(description = "커뮤니티 지역", example = "SEOUL")
private Region region;

@Schema(description = "커뮤니티 사진")
private String imageUrl;

@Schema(description = "커뮤니티 좋아요 수")
private int likeCount;

//@Schema(description = "사용자 아이디", example = "user123")
//private String userid;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createdAt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
@NoArgsConstructor
@Builder
@Schema(description = "커뮤니티 응답 객체")
public class CommunityResponse extends BaseTime {
public class CommunityResponse {
private Long id;

@Schema(description = "사용자 아이디", example = "user123")
private String userid;
//@Schema(description = "사용자 아이디", example = "user123")
//private String userid;

@Schema(description = "커뮤니티 글 제목", example = "전통시장")
private String title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public class Community extends BaseTime {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne
@JoinColumn(name = "user_id")
private User user;
//@ManyToOne
//@JoinColumn(name = "user_id")
//private User user;

@Column(nullable = false)
private String userid;
//@Column(nullable = false)
//private String userid;

@Column(nullable = false)
private String title;
Expand Down Expand Up @@ -56,7 +56,7 @@ public class Community extends BaseTime {

@Builder
public Community(String title, String originalContent, String modifiedContent, String finalContent,
Region region, String image, String imageUrl, int likeCount) {
Region region, String image, String imageUrl, int likeCount, User user) {
this.title = title;
this.originalContent = originalContent;
this.modifiedContent = modifiedContent;
Expand All @@ -65,7 +65,7 @@ public Community(String title, String originalContent, String modifiedContent, S
this.image = image;
this.imageUrl = imageUrl;
this.likeCount = likeCount;
this.user = user;
this.userid = user.getUserid();
//this.user = user;
//this.userid = user.getUserid();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public CommunityResponse getCommunity(Long communityId) {

CommunityResponse response = new CommunityResponse();
response.setId(community.getId());
response.setUserid(community.getUser().getUserid());
//response.setUserid(community.getUser().getUserid());
response.setTitle(community.getTitle());
response.setContent(community.getFinalContent() != null ? community.getFinalContent() : community.getModifiedContent());
response.setRegion(community.getRegion());
Expand All @@ -121,7 +121,7 @@ public CommunityResponse increaseLikeCount(Long id) {
private CommunityResponse mapToResponse(Community community) {
CommunityResponse response = new CommunityResponse();
response.setId(community.getId());
response.setUserid(community.getUser().getUserid());
//response.setUserid(community.getUser().getUserid());
response.setTitle(community.getTitle());
response.setContent(community.getFinalContent() != null ? community.getFinalContent() : community.getModifiedContent());
response.setRegion(community.getRegion());
Expand All @@ -136,7 +136,7 @@ public List<CommunityResponse> getAllCommunities() {
return communityRepository.findAllByOrderByCreatedAtDesc().stream()
.map(community -> CommunityResponse.builder()
.id(community.getId())
.userid(community.getUser().getUserid())
//.userid(community.getUser().getUserid())
.title(community.getTitle())
.imageUrl(community.getImageUrl())
.createdAt(community.getCreatedAt())
Expand Down