Allow isActive to be updated for standard objects (#2651)
* Allow isActive to be updated for standard objects * Allow isActive to be updated for standard objects/fields
This commit is contained in:
@ -40,7 +40,22 @@ export class BeforeUpdateOneField<T extends UpdateFieldInput>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fieldMetadata.isCustom) {
|
if (!fieldMetadata.isCustom) {
|
||||||
throw new BadRequestException("Standard Fields can't be updated");
|
if (
|
||||||
|
Object.keys(instance.update).length === 1 &&
|
||||||
|
instance.update.hasOwnProperty('isActive') &&
|
||||||
|
instance.update.isActive !== undefined
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
id: instance.id,
|
||||||
|
update: {
|
||||||
|
isActive: instance.update.isActive,
|
||||||
|
} as T,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new BadRequestException(
|
||||||
|
'Only isActive field can be updated for standard fields',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.checkIfFieldIsEditable(instance.update);
|
this.checkIfFieldIsEditable(instance.update);
|
||||||
|
|||||||
@ -48,7 +48,22 @@ export class BeforeUpdateOneObject<T extends UpdateObjectInput>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!objectMetadata.isCustom) {
|
if (!objectMetadata.isCustom) {
|
||||||
throw new BadRequestException("Standard Objects can't be updated");
|
if (
|
||||||
|
Object.keys(instance.update).length === 1 &&
|
||||||
|
instance.update.hasOwnProperty('isActive') &&
|
||||||
|
instance.update.isActive !== undefined
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
id: instance.id,
|
||||||
|
update: {
|
||||||
|
isActive: instance.update.isActive,
|
||||||
|
} as T,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new BadRequestException(
|
||||||
|
'Only isActive field can be updated for standard objects',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user