Rework relations (#3431)

* Rework relations

* Fix tests
This commit is contained in:
Charles Bochet
2024-01-15 12:07:23 +01:00
committed by GitHub
parent 8c96acc2a3
commit 16a24c5f0c
60 changed files with 392 additions and 463 deletions

View File

@ -35,7 +35,7 @@ describe('FilterInputFactory', () => {
};
expect(() => service.create(request, objectMetadata)).toThrow(
"field 'wrongField' does not exist in 'testingObject' object",
"field 'wrongField' does not exist in 'objectName' object",
);
});

View File

@ -112,7 +112,7 @@ describe('OrderByInputFactory', () => {
};
expect(() => service.create(request, objectMetadata)).toThrow(
"field 'wrongField' does not exist in 'testingObject' object",
"field 'wrongField' does not exist in 'objectName' object",
);
});
});

View File

@ -1,6 +1,7 @@
import { BadRequestException } from '@nestjs/common';
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
import { computeObjectTargetTable } from 'src/workspace/utils/compute-object-target-table.util';
export const getFieldType = (
objectMetadataItem,
@ -28,7 +29,9 @@ export const checkFields = (objectMetadataItem, fieldNames): void => {
.includes(fieldName)
) {
throw new BadRequestException(
`field '${fieldName}' does not exist in '${objectMetadataItem.targetTableName}' object`,
`field '${fieldName}' does not exist in '${computeObjectTargetTable(
objectMetadataItem,
)}' object`,
);
}
}