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
2 changes: 1 addition & 1 deletion ServerlessFunction/buildspec-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ phases:
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--parameter-overrides Environment=$ENVIRONMENT
--parameter-overrides Environment=$ENVIRONMENT ExistingCognitoUserPoolId=ap-northeast-2_ezDwzFCzR ExistingCognitoClientId=4ns077jcr1pkue2vvisr6qdpu5
- echo "Deployment completed on $(date)"

cache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,22 @@ public Optional<NewsArticle> getArticle(String articleId) {
}

/**
* 오늘의 뉴스 목록 조회
* 오늘의 뉴스 목록 조회 (오늘 기사 없으면 어제 기사 조회)
*/
public PaginatedResult<NewsArticle> getTodayNews(int limit, String cursor) {
String today = LocalDate.now().toString();
logger.debug("오늘의 뉴스 조회: date={}, limit={}", today, limit);
return articleRepository.findByDate(today, limit, cursor);

PaginatedResult<NewsArticle> result = articleRepository.findByDate(today, limit, cursor);

// 오늘 기사가 없으면 어제 기사 조회
if (result.items().isEmpty() && cursor == null) {
String yesterday = LocalDate.now().minusDays(1).toString();
logger.debug("오늘 기사 없음, 어제 기사 조회: date={}", yesterday);
result = articleRepository.findByDate(yesterday, limit, cursor);
}

return result;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions ServerlessFunction/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,11 @@ Resources:
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref NewsTable
- Statement:
- Effect: Allow
Action:
- bedrock:InvokeModel
Resource: "*"
Events:
DailySchedule:
Type: Schedule
Expand Down
Loading