Skip to content

Commit eb12253

Browse files
committed
Remove bad hack for default filter fields now that we just handle null properly
1 parent 6fa0938 commit eb12253

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/common/filter-field.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { applyDecorators } from '@nestjs/common';
22
import { Field } from '@nestjs/graphql';
3-
import { Transform, Type } from 'class-transformer';
3+
import { Type } from 'class-transformer';
44
import { ValidateNested } from 'class-validator';
55
import { Constructor, HasRequiredKeys } from 'type-fest';
6-
import { DefaultValue } from './default-value';
76
import { AbstractClassType } from './types';
87

98
/**
@@ -28,6 +27,4 @@ export const FilterField = <T extends object>(
2827
]),
2928
Type(type),
3029
ValidateNested(),
31-
DefaultValue.Set({}), // Default when omitted
32-
Transform(({ value }) => value || {}), // null -> {}
3330
);

src/common/pagination.input.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { setHas } from '@seedcompany/common';
44
import { Matches, Max, Min } from 'class-validator';
55
import { stripIndent } from 'common-tags';
66
import { DataObject } from './data-object';
7-
import { DefaultValue } from './default-value';
87
import { Order } from './order.enum';
98
import { AbstractClassType } from './types';
109

@@ -126,7 +125,7 @@ export const ListArg = <T extends PaginationInput>(
126125
name: 'input',
127126
type: () => input,
128127
nullable: true,
129-
defaultValue: DataObject.defaultValue(input, DefaultValue.Get(input)),
128+
defaultValue: DataObject.defaultValue(input),
130129
...opts,
131130
},
132131
...pipes,

0 commit comments

Comments
 (0)