Refactor standard relations update at custom object renaming (#8638)
Refactoring update of standard relations when a custom object is renamed, after observing occasional issues. --------- Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
import { capitalize } from 'src/utils/capitalize';
|
||||
|
||||
export const buildDescriptionForRelationFieldMetadataOnFromField = ({
|
||||
relationObjectMetadataNamePlural,
|
||||
targetObjectLabelSingular,
|
||||
}: {
|
||||
relationObjectMetadataNamePlural: string;
|
||||
targetObjectLabelSingular: string;
|
||||
}) => {
|
||||
const description = `${capitalize(relationObjectMetadataNamePlural)} tied to the ${targetObjectLabelSingular}`;
|
||||
|
||||
return { description };
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { capitalize } from 'src/utils/capitalize';
|
||||
|
||||
export const buildDescriptionForRelationFieldMetadataOnToField = ({
|
||||
relationObjectMetadataNamePlural,
|
||||
targetObjectLabelSingular,
|
||||
}: {
|
||||
relationObjectMetadataNamePlural: string;
|
||||
targetObjectLabelSingular: string;
|
||||
}) => {
|
||||
const description = `${capitalize(relationObjectMetadataNamePlural)} ${targetObjectLabelSingular}`;
|
||||
|
||||
return { description };
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
export const buildNameLabelAndDescriptionForForeignKeyFieldMetadata = ({
|
||||
targetObjectNameSingular,
|
||||
targetObjectLabelSingular,
|
||||
relatedObjectLabelSingular,
|
||||
}: {
|
||||
targetObjectNameSingular: string;
|
||||
targetObjectLabelSingular: string;
|
||||
relatedObjectLabelSingular: string;
|
||||
}) => {
|
||||
const name = `${targetObjectNameSingular}Id`;
|
||||
const label = `${targetObjectLabelSingular} ID (foreign key)`;
|
||||
const description = `${relatedObjectLabelSingular} ${targetObjectLabelSingular} id foreign key`;
|
||||
|
||||
return { name, label, description };
|
||||
};
|
||||
Reference in New Issue
Block a user