feat: set field as custom object label identifier in Object Detail (#3360)

* feat: set field as custom object label identifier in Object Detail

Closes #3302

* feat: prevent disabling Object label identitifer field in back-end

* refactor: review - extract isLabelIdentifier variable
This commit is contained in:
Thaïs
2024-01-17 08:19:41 -03:00
committed by GitHub
parent 8864528d55
commit 96d990e275
12 changed files with 166 additions and 79 deletions

View File

@ -186,6 +186,14 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
throw new NotFoundException('Object does not exist');
}
if (
objectMetadata.labelIdentifierFieldMetadataId ===
existingFieldMetadata.id &&
fieldMetadataInput.isActive === false
) {
throw new BadRequestException('Cannot deactivate label identifier field');
}
// Check if the id of the options has been provided
if (fieldMetadataInput.options) {
for (const option of fieldMetadataInput.options) {