Skip to content

Commit

Permalink
feat: Added new sort "added" for shows / movies
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Oct 13, 2020
1 parent 72d3206 commit 36ff1c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
13 changes: 6 additions & 7 deletions apps/api/src/shared/content/content.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ export abstract class ContentService {
protected getQuery(contentArgs: ContentsArgs): object {
let query = {}

if (contentArgs.noBookmarks) {
query = {
bookmarked: false
}
}

if (contentArgs.query && contentArgs.query.trim().length > 0) {
// TODO:: Maybe implement Text index for improved search?
query = {
...query,
title: {
Expand All @@ -43,6 +36,7 @@ export abstract class ContentService {
return {
title: order
}

case 'rating':
return {
'rating.votes': order,
Expand All @@ -60,6 +54,11 @@ export abstract class ContentService {
'rating.watching': order
}

case 'added':
return {
createdAt: order
}

case 'year':
return {
year: order
Expand Down
3 changes: 0 additions & 3 deletions apps/api/src/shared/content/dto/contents.args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export class ContentsArgs {
@Field()
sort: string = 'trending'

@Field()
noBookmarks: boolean = false

@Field({ nullable: true })
query: string = null

Expand Down

0 comments on commit 36ff1c2

Please sign in to comment.