From c4ad99fdfc3444aa704daa44c6b8e007f2ad28ea Mon Sep 17 00:00:00 2001
From: Louis Capitanchik <contact@louiscap.co>
Date: Sun, 12 Jan 2020 23:54:49 +0000
Subject: [PATCH] Pull feed from the last month

---
 src/http/controllers/api/storage.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/http/controllers/api/storage.js b/src/http/controllers/api/storage.js
index eb26474..1cbad52 100644
--- a/src/http/controllers/api/storage.js
+++ b/src/http/controllers/api/storage.js
@@ -4,6 +4,7 @@ const HttpError = require('core/errors/HttpError')
 const mimeType = require('mime-types')
 const uuid = require('uuid/v4')
 const { fs, env } = require('bootstrap')
+const moment = require('moment')
 
 const storage = new Storage({ keyFilename: fs.path('google-storage.json') })
 
@@ -87,6 +88,9 @@ exports.feed = async ctx => {
 		feed: (await File.findAll({
 			where: {
 				approved: true,
+				created_at: {
+					[Sequelize.Op.gt]: moment.utc().subtract(1, 'month').toISOString(),
+				},
 			},
 			order: [['created_at', 'desc']],
 			attributes: {
-- 
GitLab