From 37603612a703a7f3f401e68aa94787c20f478489 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Mon, 30 Jun 2025 00:48:13 -0500 Subject: [PATCH] Refine 'recents' spec --- src/photo/db/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/photo/db/index.ts b/src/photo/db/index.ts index 6ab15b4d..2f3203dd 100644 --- a/src/photo/db/index.ts +++ b/src/photo/db/index.ts @@ -94,6 +94,10 @@ export const getWheresFromOptions = ( wheresValues.push(maximumAspectRatio); } if (recent) { + // Newest upload must be within past 2 weeks + // eslint-disable-next-line max-len + wheres.push('(SELECT MAX(created_at) FROM photos) >= (now() - INTERVAL \'14 days\')'); + // Selects must be within 2 weeks of newest upload // eslint-disable-next-line max-len wheres.push('created_at >= (SELECT MAX(created_at) - INTERVAL \'14 days\' FROM photos)'); }