Fix input position backfill (#5731)

Some objects do not have position field so they should not be backfilled
This commit is contained in:
Thomas Trompette 2024-06-04 13:26:40 +02:00 committed by GitHub
parent a4e5e486f5
commit b1f12d7257
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import {
import { RecordFilter } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { hasPositionField } from 'src/engine/metadata-modules/object-metadata/utils/has-position-field.util';
import { RecordPositionFactory } from './record-position.factory';
@ -39,6 +40,8 @@ export class QueryRunnerArgsFactory {
]),
);
const shouldBackfillPosition = hasPositionField(options.objectMetadataItem);
switch (resolverArgsType) {
case ResolverArgsType.CreateMany:
return {
@ -47,7 +50,7 @@ export class QueryRunnerArgsFactory {
(args as CreateManyResolverArgs).data.map((arg, index) =>
this.overrideDataByFieldMetadata(arg, options, fieldMetadataMap, {
argIndex: index,
shouldBackfillPosition: true,
shouldBackfillPosition,
}),
),
),

View File

@ -0,0 +1,6 @@
import { ObjectMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/object-metadata.interface';
export const hasPositionField = (objectMetadataItem: ObjectMetadataInterface) =>
['opportunity', 'person', 'company'].includes(
objectMetadataItem.nameSingular,
) || objectMetadataItem.isCustom;