From f8ed6b200903590eb965ac8c6987747a4ba98476 Mon Sep 17 00:00:00 2001 From: Mitch Downey Date: Sat, 27 Apr 2024 10:59:58 -0500 Subject: [PATCH 1/2] Completely revert addOrderByQuery to 4.16.15 --- src/lib/utility/index.ts | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/lib/utility/index.ts b/src/lib/utility/index.ts index 10844522..5c958161 100644 --- a/src/lib/utility/index.ts +++ b/src/lib/utility/index.ts @@ -151,50 +151,45 @@ export const addOrderByToQuery = (qb, type, sort, sortDateKey, allowRandom, isFr } else if (sort === 'live-item-start-desc') { qb.orderBy(`liveItem.start`, descKey) } else if (sort === 'top-past-day') { - qb.leftJoin( + qb.innerJoin( ormStatsType, `stats_${type}`, `${type}.id = stats_${type}.${statsParentId}_id AND stats_${type}.timeframe = :timeframe`, { timeframe: 'daily' } ) - - qb.addOrderBy(`stats_${type}.play_count`, descKey) + qb.orderBy(`stats_${type}.play_count`, descKey) } else if (sort === 'top-past-week') { - qb.leftJoin( + qb.innerJoin( ormStatsType, `stats_${type}`, `${type}.id = stats_${type}.${statsParentId}_id AND stats_${type}.timeframe = :timeframe`, { timeframe: 'weekly' } ) - - qb.addOrderBy(`stats_${type}.play_count`, descKey) + qb.orderBy(`stats_${type}.play_count`, descKey) } else if (sort === 'top-past-month') { - qb.leftJoin( + qb.innerJoin( ormStatsType, `stats_${type}`, `${type}.id = stats_${type}.${statsParentId}_id AND stats_${type}.timeframe = :timeframe`, { timeframe: 'monthly' } ) - - qb.addOrderBy(`stats_${type}.play_count`, descKey) + qb.orderBy(`stats_${type}.play_count`, descKey) } else if (sort === 'top-past-year') { - qb.leftJoin( + qb.innerJoin( ormStatsType, `stats_${type}`, `${type}.id = stats_${type}.${statsParentId}_id AND stats_${type}.timeframe = :timeframe`, { timeframe: 'yearly' } ) - - qb.addOrderBy(`stats_${type}.play_count`, descKey) + qb.orderBy(`stats_${type}.play_count`, descKey) } else if (sort === 'top-all-time') { - qb.leftJoin( + qb.innerJoin( ormStatsType, `stats_${type}`, `${type}.id = stats_${type}.${statsParentId}_id AND stats_${type}.timeframe = :timeframe`, { timeframe: 'all_time' } ) - - qb.addOrderBy(`stats_${type}.play_count`, descKey) + qb.orderBy(`stats_${type}.play_count`, descKey) } else if (sort === 'most-recent') { qb.orderBy(`${type}.${sortDateKey}`, descKey) } else if (sort === 'oldest') { @@ -210,14 +205,13 @@ export const addOrderByToQuery = (qb, type, sort, sortDateKey, allowRandom, isFr } else if (sort === 'episode-number-asc') { qb.orderBy(`${type}.itunesEpisode`, ascKey) } else { - qb.leftJoin( + qb.innerJoin( ormStatsType, `stats_${type}`, `${type}.id = stats_${type}.${type}_id AND stats_${type}.timeframe = :timeframe`, { timeframe: 'weekly' } ) - - qb.addOrderBy(`stats_${type}.play_count`, descKey) + qb.orderBy(`stats_${type}.play_count`, descKey) } return qb From bab3753415f0fd4e4967f1c225d390ff0b287ae7 Mon Sep 17 00:00:00 2001 From: Mitch Downey Date: Sat, 27 Apr 2024 11:00:09 -0500 Subject: [PATCH 2/2] Bump to version 4.16.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 214e1331..98d92d95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "podverse-api", - "version": "4.16.17", + "version": "4.16.18", "description": "Data API, database migration scripts, and backend services for all Podverse models.", "contributors": [ "Mitch Downey"