Commit 128a4577 authored by nanahira's avatar nanahira

fix

parent 3b14e338
Pipeline #35239 failed with stages
in 11 seconds
...@@ -54,7 +54,9 @@ export class RestfulFactory<T> { ...@@ -54,7 +54,9 @@ export class RestfulFactory<T> {
readonly fieldsToOmit = _.uniq([ readonly fieldsToOmit = _.uniq([
...(getSpecificFields(this.entityClass, 'notColumn') as (keyof T)[]), ...(getSpecificFields(this.entityClass, 'notColumn') as (keyof T)[]),
...(this.options.fieldsToOmit || []), ...(this.options.fieldsToOmit || []),
...getTypeormRelations(this.entityClass).map((r) => r.propertyName), ...getTypeormRelations(this.entityClass).map(
(r) => r.propertyName as keyof T,
),
]); ]);
private readonly basicInputDto = OmitType( private readonly basicInputDto = OmitType(
this.entityClass, this.entityClass,
...@@ -99,7 +101,7 @@ export class RestfulFactory<T> { ...@@ -99,7 +101,7 @@ export class RestfulFactory<T> {
const resultDto = OmitType(this.entityClass, [...outputFieldsToOmit]); const resultDto = OmitType(this.entityClass, [...outputFieldsToOmit]);
const relations = getTypeormRelations(this.entityClass); const relations = getTypeormRelations(this.entityClass);
for (const relation of relations) { for (const relation of relations) {
if (outputFieldsToOmit.has(relation.propertyName)) continue; if (outputFieldsToOmit.has(relation.propertyName as keyof T)) continue;
const replace = (useClass: [AnyClass]) => { const replace = (useClass: [AnyClass]) => {
const oldApiProperty = const oldApiProperty =
Reflect.getMetadata( Reflect.getMetadata(
......
...@@ -27,7 +27,7 @@ export function getTypeormRelations<T>(cl: ClassType<T>) { ...@@ -27,7 +27,7 @@ export function getTypeormRelations<T>(cl: ClassType<T>) {
return { return {
isArray, isArray,
propertyClass, propertyClass,
propertyName: relation.propertyName as keyof T & string, propertyName: relation.propertyName,
}; };
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment