Skip to content

Commit

Permalink
chore: improve streams query – filter boring streams
Browse files Browse the repository at this point in the history
  • Loading branch information
enijar committed May 15, 2024
1 parent f7e8acb commit 7d73a10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/src/actions/streams.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand Down

0 comments on commit 7d73a10

Please sign in to comment.