diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java index 9be975da..058a2ff9 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java @@ -26,12 +26,13 @@ public class AnswerDetailResponse { private Integer heartCount; private Integer curiousCount; private Integer sadCount; + private Integer connectCount; public AnswerDetailResponse(Long answerId, Long questionId, String questionContent, Long memberId, String content, String memberNickname, String nickname, Boolean profileOnOff, String linkAttachments, String musicName, String musicSinger, String musicAudioUrl, String imageUrl, LocalDateTime createdDate, - Integer heartCount, Integer curiousCount, Integer sadCount) { + Integer heartCount, Integer curiousCount, Integer sadCount, Integer connectCount) { this.answerId = answerId; this.questionId = questionId; this.questionContent = questionContent; @@ -49,16 +50,17 @@ public AnswerDetailResponse(Long answerId, Long questionId, String questionConte this.heartCount = heartCount; this.curiousCount = curiousCount; this.sadCount = sadCount; + this.connectCount = connectCount; } public static AnswerDetailResponse of(Long answerId, Long questionId, String questionContent, Long memberId, String content, String memberNickname, String nickname, Boolean profileOnOff, String linkAttachments, String musicName, String musicSinger, String musicAudioUrl, String imageUrl, LocalDateTime createdDate, - Integer heartCount, Integer curiousCount, Integer sadCount) { + Integer heartCount, Integer curiousCount, Integer sadCount, Integer connectCount) { return new AnswerDetailResponse(answerId, questionId, questionContent, memberId, content, memberNickname, nickname, profileOnOff, linkAttachments, musicName, musicSinger, musicAudioUrl, imageUrl, createdDate, - heartCount, curiousCount, sadCount); + heartCount, curiousCount, sadCount, connectCount); } } diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/entity/Answer.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/entity/Answer.java index 5d2d667b..d75702ba 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/entity/Answer.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/entity/Answer.java @@ -71,6 +71,9 @@ public class Answer { @Column(name = "sad_count", nullable = false) private int sadCount; + @Column(name = "connect_count", nullable = false) + private int connectCount; + @Column(name = "created_date", nullable = false) private LocalDateTime createdDate; @@ -82,23 +85,10 @@ public class Answer { public static Answer of(Long id, Question question, Category category, Member member, String nickname,String content, List imageFiles, Music music, String linkAttachments, String imageUrl, int heartCount, - int curiousCount, int sadCount, LocalDateTime createdDate, boolean profileOnOff) { + int curiousCount, int sadCount, int connectCount, LocalDateTime createdDate, boolean profileOnOff) { return new Answer(id, question, category, member, nickname, imageFiles, content, music, linkAttachments,imageUrl, heartCount, - curiousCount, sadCount, createdDate,null, profileOnOff); + curiousCount, sadCount, connectCount, createdDate,null, profileOnOff); } - public void increaseReactionCount(ReactionValue reaction) { - switch (reaction) { - case HEART: // 좋아요 - this.heartCount++; - break; - case CURIOUS: // 궁금해요 - this.curiousCount++; - break; - case SAD: // 슬퍼요 - this.sadCount++; - break; - } - } } diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java index b0c19ff5..76954c91 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java @@ -71,7 +71,8 @@ public AnswerDetailResponse toDomain(Answer answer) { answer.getCreatedDate(), answer.getHeartCount(), answer.getCuriousCount(), - answer.getSadCount() + answer.getSadCount(), + answer.getConnectCount() ); } diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/question/service/QuestionService.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/question/service/QuestionService.java index 1273631c..f827c164 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/question/service/QuestionService.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/question/service/QuestionService.java @@ -33,7 +33,7 @@ public QuestionDetailResponse createQuestion(QuestionCreateRequest request, Long Question question = questionMapper.toEntity(request, member); Question savedQuestion = questionRepository.save(question); - firebaseNotificationService.notifyNewQuestion(member, question); // 파이어베이스 메세지 송신 + //firebaseNotificationService.notifyNewQuestion(member, question); // 파이어베이스 메세지 송신 return questionMapper.toDomain(savedQuestion); } @@ -54,7 +54,7 @@ public QuestionDetailResponse updateQuestion(Long questionId, String content, Bo // 질문 업데이트 후 저장 Question updatedQuestion = questionRepository.save(question); - firebaseNotificationService.notifyNewQuestion(updatedQuestion.getMember(), updatedQuestion); // 파이어베이스 메세지 송신 + //firebaseNotificationService.notifyNewQuestion(updatedQuestion.getMember(), updatedQuestion); // 파이어베이스 메세지 송신 return questionMapper.toDomain(updatedQuestion); diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/MemberAnswerReactionController.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/MemberAnswerReactionController.java index a584a587..3f83c601 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/MemberAnswerReactionController.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/MemberAnswerReactionController.java @@ -24,7 +24,7 @@ public ResponseEntity createReaction( return ResponseEntity.ok(memberAnswerReactionService.createReaction(memberId, answerId, reactionDto.getReaction())); } - // 통했당~ + /*// 통했당~ @PostMapping("/connection/{memberId}/{answerId}/{destinationMemberId}") public ResponseEntity createClickReaction( @PathVariable Long memberId, // 자기자신 (통했당 하는 주체) @@ -36,5 +36,5 @@ public ResponseEntity createC return ResponseEntity.ok(memberAnswerReactionService.createConnectionReaction(memberId, answerId)); else return ResponseEntity.ok(memberAnswerReactionService.connectConnectionReaction(memberId, answerId, destinationMemberId)); - } + }*/ } \ No newline at end of file diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/api/MemberAnswerReactionApi.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/api/MemberAnswerReactionApi.java index 7597e996..ba896258 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/api/MemberAnswerReactionApi.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/controller/api/MemberAnswerReactionApi.java @@ -61,7 +61,7 @@ ResponseEntity createReaction(@Paramete @Parameter(description = "답변의 ID", required = true) @PathVariable Long answerId, @RequestBody ReactionRequest.create reactionDto); - @Operation( + /* @Operation( summary = "통했당 생성", description = "지정된 멤버 ID, 답변 ID, 대상 멤버 ID에 대한 '통했당'을 생성합니다. " + "다른 피드에 '통했당'을 남길경우 memberId, answerId만 필요합니다. " + @@ -98,5 +98,5 @@ ResponseEntity createReaction(@Paramete }) ResponseEntity createClickReaction(@Parameter(description = "멤버의 ID", required = true) @PathVariable Long memberId, @Parameter(description = "답변의 ID", required = true) @PathVariable Long answerId, - @Parameter(description = "대상 멤버의 ID (피드주인이 통했당 완료할때만 가능)", required = false) @RequestParam(required = false) Long destinationMemberId); + @Parameter(description = "대상 멤버의 ID (피드주인이 통했당 완료할때만 가능)", required = false) @RequestParam(required = false) Long destinationMemberId);*/ } diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/dto/ReactionResponse.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/dto/ReactionResponse.java index c30861fe..630284eb 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/dto/ReactionResponse.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/dto/ReactionResponse.java @@ -16,6 +16,7 @@ public static class ReactionInformationDto { private int heartCount; private int curiousCount; private int sadCount; + private int connectCount; public static ReactionInformationDto of(Answer answer, boolean isClicked) { return ReactionInformationDto.builder() @@ -23,11 +24,12 @@ public static ReactionInformationDto of(Answer answer, boolean isClicked) { .heartCount(answer.getHeartCount()) .curiousCount(answer.getCuriousCount()) .sadCount(answer.getSadCount()) + .connectCount(answer.getConnectCount()) .build(); } } - @Getter + /*@Getter @Setter @Builder @NoArgsConstructor @@ -42,5 +44,5 @@ public static ConnectionReactionInformationDto of(boolean isClicked, boolean isM .isMatched(isMatched) .build(); } - } + }*/ } diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/entity/ReactionValue.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/entity/ReactionValue.java index 9479b88a..493fbc60 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/entity/ReactionValue.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/entity/ReactionValue.java @@ -1,5 +1,5 @@ package com.web.baebaeBE.domain.reaction.entity; public enum ReactionValue { - HEART, CURIOUS, SAD, CONNECTION + HEART, CURIOUS, SAD, CONNECT } diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/MemberAnswerReactionService.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/MemberAnswerReactionService.java index 60fd6973..5a521163 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/MemberAnswerReactionService.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/MemberAnswerReactionService.java @@ -61,7 +61,7 @@ public ReactionResponse.ReactionInformationDto createReaction(Long memberId, Lon return ReactionResponse.ReactionInformationDto.of(answer,isClicked); } - // 피드 주인이 아닌 다른 사람이 통했당 신청 + /*// 피드 주인이 아닌 다른 사람이 통했당 신청 public ReactionResponse.ConnectionReactionInformationDto createConnectionReaction(Long memberId, Long answerId) { Member member = memberRepository.findById(memberId) .orElseThrow(() -> new BusinessException(ReactionException.NOT_EXIST_MEMBER)); @@ -107,5 +107,5 @@ public ReactionResponse.ConnectionReactionInformationDto connectConnectionReacti } else { throw new BusinessException(ReactionException.NOT_EXIST_CONNECTION_REACTION); } - } + }*/ } \ No newline at end of file diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/ReactionUpdateService.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/ReactionUpdateService.java index 89cf666e..33e6d771 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/ReactionUpdateService.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/reaction/service/ReactionUpdateService.java @@ -22,6 +22,9 @@ public void increaseReactionCount(Answer answer, ReactionValue reaction) { case SAD: // 슬퍼요 answer.setSadCount(answer.getSadCount() + 1); break; + case CONNECT: // 통했당 + answer.setConnectCount(answer.getConnectCount() + 1); + break; } } @@ -36,6 +39,9 @@ public void decreaseReactionCount(Answer answer, ReactionValue reaction) { case SAD: // 슬퍼요 answer.setSadCount(answer.getSadCount() - 1); break; + case CONNECT: // 통했당 + answer.setConnectCount(answer.getConnectCount() - 1); + break; } } }