Skip to content

Commit

Permalink
Merge pull request #218 from prgrms-web-devcourse-final-project/develop
Browse files Browse the repository at this point in the history
CI-CD
  • Loading branch information
l2yujw authored Dec 10, 2024
2 parents 7d266e1 + 93bdbde commit ee38995
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import postman.bottler.letter.domain.LetterType;
import postman.bottler.letter.dto.LetterBoxDTO;
import postman.bottler.letter.exception.LetterNotFoundException;
import postman.bottler.letter.exception.TempRecommendationsNotFoundException;
import postman.bottler.letter.service.LetterBoxService;
import postman.bottler.letter.service.LetterServiceRedis;
import postman.bottler.notification.dto.request.RecommendNotificationRequestDTO;
Expand Down Expand Up @@ -46,6 +45,9 @@ public RecommendNotificationRequestDTO updateRecommendationsFromTemp(Long userId
String activeKey = RedisLetterKeyUtil.getActiveRecommendationKey(userId);

List<Long> tempRecommendations = getTempRecommendations(tempKey);
if (tempRecommendations == null) {
return null;
}
List<Long> activeRecommendations = getActiveRecommendations(activeKey);

Long recommendId = findFirstValidLetter(tempRecommendations);
Expand Down Expand Up @@ -92,11 +94,10 @@ private List<Long> getActiveRecommendations(String activeKey) {
return activeRecommendations;
}

@NotNull
private List<Long> getTempRecommendations(String tempKey) {
List<Long> tempRecommendations = redisTemplate.opsForValue().get(tempKey);
if (tempRecommendations == null || tempRecommendations.isEmpty()) {
throw new TempRecommendationsNotFoundException("추천된 키워드 편지가 존재하지 않습니다.");
return null;
}
return tempRecommendations;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package postman.bottler.letter.infra.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -20,6 +21,7 @@ public class LetterEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
@Column(columnDefinition = "TEXT")
private String content;
private String font;
private String paper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package postman.bottler.letter.infra.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -20,6 +21,7 @@ public class ReplyLetterEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
@Column(columnDefinition = "TEXT")
private String content;
private String font;
private String paper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class MapLetterEntity {
@NotNull
private String title;
@NotNull
@Column(columnDefinition = "TEXT")
private String content;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package postman.bottler.mapletter.infra.entity;

import com.google.firebase.database.annotations.NotNull;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand Down Expand Up @@ -30,6 +31,7 @@ public class ReplyMapLetterEntity {
@NotNull
private String label;
@NotNull
@Column(columnDefinition = "TEXT")
private String content;
private boolean isBlocked;
private boolean isDeleted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ public void updateAllRecommendations() {
// 알림전송
List<RecommendNotificationRequestDTO> recommendNotificationRequestDTOS = new ArrayList<>();
userIds.forEach(userId ->
recommendNotificationRequestDTOS.add(redisLetterService.updateRecommendationsFromTemp(userId))
{
RecommendNotificationRequestDTO recommendNotificationRequestDTO = redisLetterService.updateRecommendationsFromTemp(
userId);
if (recommendNotificationRequestDTO != null) {
recommendNotificationRequestDTOS.add(recommendNotificationRequestDTO);
}
}
);
notificationService.sendKeywordNotifications(recommendNotificationRequestDTOS);
}
Expand Down

0 comments on commit ee38995

Please sign in to comment.