Skip to content

Commit

Permalink
Remove duplicated types from the scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrinalin4ik committed Feb 21, 2023
1 parent bd85900 commit 3c6345c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions dist-lib/filters/input-type-generator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist-lib/filters/input-type-generator.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions lib/filters/input-type-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ const filterFullTypes = new Map();
const filterTypes = new Map();
const propertyTypes = new Map()

const generateFilterPropertyType = (field, parentName: string) => {
const key = `${standardize(field.name)}_${parentName}_${InputMapPrefixes.PropertyFilterInputType}`;
const generateFilterPropertyType = (field) => {
const typeName = field.typeFn && field.typeFn()?.name;
const key = `${standardize(typeName)}_${InputMapPrefixes.PropertyFilterInputType}`;

const propType = propertyTypes.get(key);
if (propType) return propType;
Expand Down Expand Up @@ -138,7 +139,7 @@ function generateFilterInputType<T extends BaseEntity>(classes: T[], name: strin
if (typeof field.typeFn === 'function') {
field.typeFn();
}
const fieldType = generateFilterPropertyType(field, name);
const fieldType = generateFilterPropertyType(field);
Field(() => fieldType, {nullable: true})(PartialObjectType.prototype, field.name)
} else {
// Relations are not supported yet
Expand Down

0 comments on commit 3c6345c

Please sign in to comment.