Fix check for alias fields (#16282)

They do not exist on fields definition
This commit is contained in:
José Varela
2022-11-02 16:10:28 +00:00
committed by GitHub
parent 8242159b4b
commit 0dce20c0b8

View File

@@ -363,9 +363,9 @@ export class FieldsService {
if (
(hookAdjustedField.type === 'alias' ||
this.schema.collections[collection].fields[field.field].type === 'alias') &&
this.schema.collections[collection].fields[field.field]?.type === 'alias') &&
hookAdjustedField.type &&
hookAdjustedField.type !== this.schema.collections[collection].fields[field.field].type
hookAdjustedField.type !== this.schema.collections[collection].fields[field.field]?.type
) {
throw new InvalidPayloadException('Alias type cannot be changed');
}