File tree 1 file changed +10
-3
lines changed
apps/graphql-api/src/bookmarks
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,15 @@ export class BookmarksService {
23
23
return [
24
24
...movies ,
25
25
...shows
26
- ] . sort ( ( itemA , itemB ) => itemB . bookmarkedOn - itemA . bookmarkedOn )
27
- // .slice(bookmarksArgs.offset, bookmarksArgs.offset + bookmarksArgs.limit)
26
+ ]
27
+ . sort ( ( itemA , itemB ) => {
28
+ console . log ( itemA )
29
+ console . log ( itemB )
30
+ const itemACompare = itemA ?. latestEpisodeAired ?? itemA . bookmarkedOn
31
+ const itemBCompare = itemB ?. latestEpisodeAired ?? itemB . bookmarkedOn
32
+
33
+ return itemBCompare - itemACompare
34
+ } )
28
35
}
29
36
30
37
async findAllMovies ( bookmarksArgs : BookmarksArgs ) : Promise < Content [ ] > {
@@ -82,7 +89,7 @@ export class BookmarksService {
82
89
bookmarked : true ,
83
90
title : {
84
91
// Update the query to make it better searchable
85
- $regex : bookmarksArgs . query . split ( ' ' ) . join ( '.+' ) ,
92
+ $regex : bookmarksArgs . query . trim ( ) . split ( ' ' ) . join ( '.+' ) ,
86
93
$options : 'i'
87
94
}
88
95
}
You can’t perform that action at this time.
0 commit comments