From 0f6e7056b76107916aaec289d305179c9d45bea0 Mon Sep 17 00:00:00 2001 From: Kainoa Kanter Date: Thu, 6 Apr 2023 22:48:07 -0700 Subject: [PATCH] days for featured --- packages/backend/src/server/api/endpoints/notes/featured.ts | 4 ++-- packages/client/src/pages/explore.featured.vue | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index a6d764bf37..47c1e13812 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -32,17 +32,17 @@ export const paramDef = { enum: ["combined", "local", "remote"], default: "local", }, + days: { type: "integer", minimum: 1, maximum: 365, default: 3 }, }, required: [], } as const; export default define(meta, paramDef, async (ps, user) => { const max = 30; - const day = 1000 * 60 * 60 * 24 * 3; // 3日前まで + const day = 1000 * 60 * 60 * 24 * ps.days; const query = Notes.createQueryBuilder("note") .addSelect("note.score") - // .where("note.userHost IS NULL") .andWhere("note.score > 0") .andWhere("note.createdAt > :date", { date: new Date(Date.now() - day) }) .andWhere("note.visibility = 'public'") diff --git a/packages/client/src/pages/explore.featured.vue b/packages/client/src/pages/explore.featured.vue index 79de49db5c..0f66307ab0 100644 --- a/packages/client/src/pages/explore.featured.vue +++ b/packages/client/src/pages/explore.featured.vue @@ -19,6 +19,9 @@ const paginationForLocal = { limit: 10, origin: 'local', offsetMode: true, + params: { + days: 14, + } }; const paginationForRemote = { @@ -27,6 +30,7 @@ const paginationForRemote = { offsetMode: true, params: { origin: 'remote', + days: 7, } }