From dfc82bab0d8d80e52fda1f9e89c0148794bf94fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ot=C3=A1vio=20Jacobi?= Date: Tue, 14 Feb 2023 10:24:07 -0300 Subject: [PATCH] Fixes deprecated pine orderby query (#9) Change-type: patch --- src/app.ts | 11 ++++++++++- src/popularity/fleet.ts | 12 ++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/app.ts b/src/app.ts index 00f5059..b048bd9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -6,7 +6,16 @@ import { featuredPage } from './featuredPage'; export const app = express(); -app.use(morgan('combined')); +app.use( + morgan('short', { + skip: (_req: express.Request, res: express.Response) => { + return ( + !(process.env.LOG_SUCCESS_RESPONSE === 'true') && res.statusCode < 400 + ); + }, + }), +); + app.use(healthRouter); app.use('/popularity', popularity); app.use('/featured-page', featuredPage); diff --git a/src/popularity/fleet.ts b/src/popularity/fleet.ts index c23b3fd..8de6ef6 100644 --- a/src/popularity/fleet.ts +++ b/src/popularity/fleet.ts @@ -47,8 +47,16 @@ export const getActiveFleets = async () => { }, }, }, - $orderby: - 'owns__public_device/$count($filter=was_recently_online eq 1) desc', + $orderby: { + owns__public_device: { + $count: { + $filter: { + was_recently_online: true, + }, + }, + }, + $dir: 'desc', + }, }, })) as unknown as Fleet[];