days for featured

This commit is contained in:
Kainoa Kanter 2023-04-06 22:48:07 -07:00
parent df7c71b1b4
commit 0f6e7056b7
2 changed files with 6 additions and 2 deletions

View File

@ -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'")

View File

@ -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,
}
}