File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed
src/collections/collections-entries/dto Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -33,11 +33,22 @@ export class FindCollectionEntriesDto extends OmitType(
3333 @IsString ( )
3434 status ?: CollectionEntryStatus ;
3535 @IsOptional ( )
36- gameFilters ?: FindCollectionEntriesGameFilterDto = {
37- category : [
38- EGameCategory . Main ,
39- EGameCategory . Remaster ,
40- EGameCategory . Remake ,
41- ] ,
42- } ;
36+ // Forces orderBy's Transform to run
37+ @Expose ( { name : "gameFilters" } )
38+ // This extra logic makes the orderBy work for GET request parameters
39+ @Transform ( ( { obj } ) => {
40+ const rawQueryString = qs . stringify ( obj ) ;
41+ const parsed = qs . parse ( rawQueryString ) ;
42+
43+ return (
44+ parsed . gameFilters ?? {
45+ category : [
46+ EGameCategory . Main ,
47+ EGameCategory . Remaster ,
48+ EGameCategory . Remake ,
49+ ] ,
50+ }
51+ ) ;
52+ } )
53+ gameFilters ?: FindCollectionEntriesGameFilterDto ;
4354}
You can’t perform that action at this time.
0 commit comments