mirror of
https://github.com/twentyhq/twenty.git
synced 2025-01-06 03:45:15 +03:00
Fix input position backfill (#5731)
Some objects do not have position field so they should not be backfilled
This commit is contained in:
parent
a4e5e486f5
commit
b1f12d7257
@ -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,
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user