Skip to content

Commit

Permalink
Set limit on old articles
Browse files Browse the repository at this point in the history
  • Loading branch information
rupinr committed Nov 2, 2024
1 parent dad59bd commit 22dd2cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ func SetLastProcessedAt(subscriptionId uint) {

func GetArticlesAfterLastProcessedTime(fromDate time.Time, sites []entity.Site) []entity.Article {
var articles []entity.Article
twoDaysAgo := time.Now().AddDate(0, 0, -2)
dto.MapToUrls(sites)
db().Where("created_at > ?", fromDate).Where("site IN ?", dto.MapToUrls(sites)).Find(&articles)
db().
Where("created_at > ? AND created_at < ?", fromDate, twoDaysAgo).
Where("site IN ?", dto.MapToUrls(sites)).
Find(&articles)
return articles
}

Expand Down

0 comments on commit 22dd2cd

Please sign in to comment.