Import - fixes (#12569)

<img width="800" alt="Screenshot 2025-06-12 at 15 22 49"
src="https://github.com/user-attachments/assets/afaa4ef1-b16c-4c05-ba4a-d77ad2ccfa76"
/>


To test : 
- unselect an option on select/multi-select matching (matching step)
- match a mutli-select field with an other field

closes : https://github.com/twentyhq/core-team-issues/issues/1065
closes : https://github.com/twentyhq/core-team-issues/issues/1066
This commit is contained in:
Etienne
2025-06-13 15:52:32 +02:00
committed by GitHub
parent 6bca562c65
commit 8e007c8b5f
9 changed files with 89 additions and 35 deletions

View File

@ -1,3 +1,4 @@
import { RATING_VALUES } from '@/object-record/record-field/meta-types/constants/RatingValues';
import { emailSchema } from '@/object-record/record-field/validation-schemas/emailSchema';
import { SpreadsheetImportFieldValidationDefinition } from '@/spreadsheet-import/types';
import { t } from '@lingui/core/macro';
@ -214,6 +215,22 @@ export const getSpreadSheetFieldValidationDefinitions = (
level: 'error',
},
];
case FieldMetadataType.RATING: {
const ratingValues = RATING_VALUES.join(', ');
return [
{
rule: 'function',
isValid: (value: string) => {
return RATING_VALUES.includes(
value as (typeof RATING_VALUES)[number],
);
},
errorMessage: `${fieldName} ${t` must be one of ${ratingValues} values`}`,
level: 'error',
},
];
}
default:
return [];
}