Connect - Relation on FE Importer (#13213)

Done : 
- Relation connect on FE Importer
- Remove templating on SpreadsheetMatchedColumn type
- Remove useless files on import
- Remove AvailableFieldsForImport type + Update SpreadsheetImportField
type and SpreadsheetImportFieldOption


To test : 
- Try import opportunities on Apple wk 
[using this
file](https://github.com/user-attachments/files/21233720/Test.import.-.opportunities-sample.csv)


closes : https://github.com/twentyhq/core-team-issues/issues/1090
This commit is contained in:
Etienne
2025-07-18 21:43:16 +02:00
committed by GitHub
parent ae04cc9e6c
commit cc71394863
90 changed files with 1615 additions and 1195 deletions

View File

@ -9,17 +9,17 @@ import { isDefined } from 'twenty-shared/utils';
import { z } from 'zod';
import { uniqueEntries } from './uniqueEntries';
export const setColumn = <T extends string>(
oldColumn: SpreadsheetColumn<T>,
field?: SpreadsheetImportField<T>,
export const setColumn = (
oldColumn: SpreadsheetColumn,
field?: SpreadsheetImportField,
data?: MatchColumnsStepProps['data'],
): SpreadsheetColumn<T> => {
): SpreadsheetColumn => {
if (field?.fieldType.type === 'select') {
const fieldOptions = field.fieldType.options;
const uniqueData = uniqueEntries(
data || [],
oldColumn.index,
) as SpreadsheetMatchedOptions<T>[];
) as SpreadsheetMatchedOptions[];
const matchedOptions = uniqueData.map((record) => {
const value = fieldOptions.find(
@ -28,8 +28,8 @@ export const setColumn = <T extends string>(
fieldOption.label === record.entry,
)?.value;
return value
? ({ ...record, value } as SpreadsheetMatchedOptions<T>)
: (record as SpreadsheetMatchedOptions<T>);
? ({ ...record, value } as SpreadsheetMatchedOptions)
: (record as SpreadsheetMatchedOptions);
});
const allMatched =
matchedOptions.filter((o) => o.value).length === uniqueData?.length;
@ -77,8 +77,8 @@ export const setColumn = <T extends string>(
fieldOption.value === entry || fieldOption.label === entry,
)?.value;
return value
? ({ entry, value } as SpreadsheetMatchedOptions<T>)
: ({ entry } as SpreadsheetMatchedOptions<T>);
? ({ entry, value } as SpreadsheetMatchedOptions)
: ({ entry } as SpreadsheetMatchedOptions);
});
const areAllMatched =
matchedOptions.filter((option) => option.value).length ===