From 7d73a10751f82da259eec02176bca83273e8a441 Mon Sep 17 00:00:00 2001 From: Enijar Date: Wed, 15 May 2024 21:11:24 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20improve=20streams=20query=20=E2=80=93?= =?UTF-8?q?=20filter=20boring=20streams?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/actions/streams.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/src/actions/streams.ts b/server/src/actions/streams.ts index 54c779f..e9f0ba9 100644 --- a/server/src/actions/streams.ts +++ b/server/src/actions/streams.ts @@ -1,5 +1,5 @@ import type { Response } from "express"; -import { FindOptions, Op } from "sequelize"; +import { FindOptions, Op, fn } from "sequelize"; import type { PrivateRequest } from "../types"; import Stream from "../entities/stream"; import paginate from "../services/paginate"; @@ -10,7 +10,13 @@ export default async function streams(req: PrivateRequest, res: Response) { let query: FindOptions["where"] = { year: { - [Op.lte]: new Date().getFullYear(), + [Op.lte]: fn(`year(now())`), + }, + rating: { + [Op.gt]: 0, + }, + seeds: { + [Op.gt]: 0, }, duration: { [Op.gt]: 0,