Convert metadata tables to camelCase (#2400)
* Convert metadata tables to camelCase * datasourcemetadataid to datasourceid * refactor metadata folders * fix command * move commands out of metadata * fix seed * rename objectId and fieldId in objectMetadataId and fieldMetadataId in FE * fix field-metadata * Fix * Fix * remove logs --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -93,10 +93,11 @@ export const CompanyShow = () => {
|
||||
{companyShowFieldDefinitions.map((fieldDefinition) => {
|
||||
return (
|
||||
<FieldContext.Provider
|
||||
key={company.id + fieldDefinition.fieldId}
|
||||
key={company.id + fieldDefinition.fieldMetadataId}
|
||||
value={{
|
||||
entityId: company.id,
|
||||
recoilScopeId: company.id + fieldDefinition.fieldId,
|
||||
recoilScopeId:
|
||||
company.id + fieldDefinition.fieldMetadataId,
|
||||
fieldDefinition,
|
||||
useUpdateEntityMutation: useUpdateOneCompanyMutation,
|
||||
hotkeyScope: InlineCellHotkeyScope.InlineCell,
|
||||
|
||||
@ -22,7 +22,7 @@ import { User } from '~/generated/graphql';
|
||||
|
||||
export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
fieldId: 'domainName',
|
||||
fieldMetadataId: 'domainName',
|
||||
label: 'Domain name',
|
||||
Icon: IconLink,
|
||||
type: 'URL',
|
||||
@ -32,7 +32,7 @@ export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldURLMetadata>,
|
||||
{
|
||||
fieldId: 'accountOwner',
|
||||
fieldMetadataId: 'accountOwner',
|
||||
label: 'Account owner',
|
||||
Icon: IconUserCircle,
|
||||
type: 'RELATION',
|
||||
@ -49,7 +49,7 @@ export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldRelationMetadata>,
|
||||
{
|
||||
fieldId: 'employees',
|
||||
fieldMetadataId: 'employees',
|
||||
label: 'Employees',
|
||||
Icon: IconUsers,
|
||||
type: 'NUMBER',
|
||||
@ -59,7 +59,7 @@ export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldNumberMetadata>,
|
||||
{
|
||||
fieldId: 'address',
|
||||
fieldMetadataId: 'address',
|
||||
label: 'Address',
|
||||
Icon: IconMap,
|
||||
type: 'TEXT',
|
||||
@ -69,7 +69,7 @@ export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldTextMetadata>,
|
||||
{
|
||||
fieldId: 'idealCustomerProfile',
|
||||
fieldMetadataId: 'idealCustomerProfile',
|
||||
label: 'ICP',
|
||||
Icon: IconTarget,
|
||||
type: 'BOOLEAN',
|
||||
@ -78,7 +78,7 @@ export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldBooleanMetadata>,
|
||||
{
|
||||
fieldId: 'xUrl',
|
||||
fieldMetadataId: 'xUrl',
|
||||
label: 'Twitter',
|
||||
Icon: IconBrandX,
|
||||
type: 'URL',
|
||||
@ -88,7 +88,7 @@ export const companyShowFieldDefinitions: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldURLMetadata>,
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Created at',
|
||||
Icon: IconCalendar,
|
||||
type: 'DATE',
|
||||
|
||||
@ -13,37 +13,37 @@ import { Company } from '~/generated/graphql';
|
||||
export const companyTableFilterDefinitions: FilterDefinitionByEntity<Company>[] =
|
||||
[
|
||||
{
|
||||
fieldId: 'name',
|
||||
fieldMetadataId: 'name',
|
||||
label: 'Name',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'employees',
|
||||
fieldMetadataId: 'employees',
|
||||
label: 'Employees',
|
||||
Icon: IconUsers,
|
||||
type: 'NUMBER',
|
||||
},
|
||||
{
|
||||
fieldId: 'domainName',
|
||||
fieldMetadataId: 'domainName',
|
||||
label: 'URL',
|
||||
Icon: IconLink,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'address',
|
||||
fieldMetadataId: 'address',
|
||||
label: 'Address',
|
||||
Icon: IconMap,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Created at',
|
||||
Icon: IconCalendarEvent,
|
||||
type: 'DATE',
|
||||
},
|
||||
{
|
||||
fieldId: 'accountOwnerId',
|
||||
fieldMetadataId: 'accountOwnerId',
|
||||
label: 'Account owner',
|
||||
Icon: IconUser,
|
||||
type: 'ENTITY',
|
||||
|
||||
@ -9,27 +9,27 @@ import { SortDefinition } from '@/ui/object/object-sort-dropdown/types/SortDefin
|
||||
|
||||
export const companyTableSortDefinitions: SortDefinition[] = [
|
||||
{
|
||||
fieldId: 'name',
|
||||
fieldMetadataId: 'name',
|
||||
label: 'Name',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
},
|
||||
{
|
||||
fieldId: 'employees',
|
||||
fieldMetadataId: 'employees',
|
||||
label: 'Employees',
|
||||
Icon: IconUsers,
|
||||
},
|
||||
{
|
||||
fieldId: 'domainName',
|
||||
fieldMetadataId: 'domainName',
|
||||
label: 'Url',
|
||||
Icon: IconLink,
|
||||
},
|
||||
{
|
||||
fieldId: 'address',
|
||||
fieldMetadataId: 'address',
|
||||
label: 'Address',
|
||||
Icon: IconMap,
|
||||
},
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Creation',
|
||||
Icon: IconCalendarEvent,
|
||||
},
|
||||
|
||||
@ -13,26 +13,26 @@ import { FilterDropdownPeopleSearchSelect } from '../../../modules/people/compon
|
||||
export const opportunityBoardFilterDefinitions: FilterDefinitionByEntity<PipelineProgress>[] =
|
||||
[
|
||||
{
|
||||
fieldId: 'amount',
|
||||
fieldMetadataId: 'amount',
|
||||
label: 'Amount',
|
||||
Icon: IconCurrencyDollar,
|
||||
type: 'NUMBER',
|
||||
},
|
||||
{
|
||||
fieldId: 'closeDate',
|
||||
fieldMetadataId: 'closeDate',
|
||||
label: 'Close date',
|
||||
Icon: IconCalendarEvent,
|
||||
type: 'DATE',
|
||||
},
|
||||
{
|
||||
fieldId: 'companyId',
|
||||
fieldMetadataId: 'companyId',
|
||||
label: 'Company',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'ENTITY',
|
||||
entitySelectComponent: <FilterDropdownCompanySearchSelect />,
|
||||
},
|
||||
{
|
||||
fieldId: 'pointOfContactId',
|
||||
fieldMetadataId: 'pointOfContactId',
|
||||
label: 'Point of contact',
|
||||
Icon: IconUser,
|
||||
type: 'ENTITY',
|
||||
|
||||
@ -3,17 +3,17 @@ import { SortDefinition } from '@/ui/object/object-sort-dropdown/types/SortDefin
|
||||
|
||||
export const opportunityBoardSortDefinitions: SortDefinition[] = [
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Creation',
|
||||
Icon: IconCalendarEvent,
|
||||
},
|
||||
{
|
||||
fieldId: 'amount',
|
||||
fieldMetadataId: 'amount',
|
||||
label: 'Amount',
|
||||
Icon: IconCurrencyDollar,
|
||||
},
|
||||
{
|
||||
fieldId: 'closeDate',
|
||||
fieldMetadataId: 'closeDate',
|
||||
label: 'Expected close date',
|
||||
Icon: IconCalendarEvent,
|
||||
},
|
||||
|
||||
@ -23,7 +23,7 @@ import { getLogoUrlFromDomainName } from '~/utils';
|
||||
|
||||
export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
{
|
||||
fieldId: 'email',
|
||||
fieldMetadataId: 'email',
|
||||
label: 'Email',
|
||||
Icon: IconMail,
|
||||
type: 'TEXT',
|
||||
@ -33,7 +33,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldTextMetadata>,
|
||||
{
|
||||
fieldId: 'company',
|
||||
fieldMetadataId: 'company',
|
||||
label: 'Company',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'RELATION',
|
||||
@ -50,7 +50,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldRelationMetadata>,
|
||||
{
|
||||
fieldId: 'phone',
|
||||
fieldMetadataId: 'phone',
|
||||
label: 'Phone',
|
||||
Icon: IconPhone,
|
||||
type: 'PHONE',
|
||||
@ -60,7 +60,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldPhoneMetadata>,
|
||||
{
|
||||
fieldId: 'jobTitle',
|
||||
fieldMetadataId: 'jobTitle',
|
||||
label: 'Job Title',
|
||||
Icon: IconBriefcase,
|
||||
type: 'TEXT',
|
||||
@ -70,7 +70,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldTextMetadata>,
|
||||
{
|
||||
fieldId: 'city',
|
||||
fieldMetadataId: 'city',
|
||||
label: 'City',
|
||||
Icon: IconMap,
|
||||
type: 'TEXT',
|
||||
@ -80,7 +80,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldTextMetadata>,
|
||||
{
|
||||
fieldId: 'linkedinUrl',
|
||||
fieldMetadataId: 'linkedinUrl',
|
||||
label: 'Linkedin URL',
|
||||
Icon: IconBrandLinkedin,
|
||||
type: 'URL',
|
||||
@ -90,7 +90,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldURLMetadata>,
|
||||
{
|
||||
fieldId: 'xUrl',
|
||||
fieldMetadataId: 'xUrl',
|
||||
label: 'X URL',
|
||||
Icon: IconBrandX,
|
||||
type: 'URL',
|
||||
@ -100,7 +100,7 @@ export const personShowFieldDefinition: FieldDefinition<FieldMetadata>[] = [
|
||||
},
|
||||
} satisfies FieldDefinition<FieldURLMetadata>,
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Created at',
|
||||
Icon: IconCalendar,
|
||||
type: 'DATE',
|
||||
|
||||
@ -13,25 +13,25 @@ import { Person } from '~/generated/graphql';
|
||||
export const personTableFilterDefinitions: FilterDefinitionByEntity<Person>[] =
|
||||
[
|
||||
{
|
||||
fieldId: 'firstName',
|
||||
fieldMetadataId: 'firstName',
|
||||
label: 'First name',
|
||||
Icon: IconUser,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'lastName',
|
||||
fieldMetadataId: 'lastName',
|
||||
label: 'Last name',
|
||||
Icon: IconUser,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'email',
|
||||
fieldMetadataId: 'email',
|
||||
label: 'Email',
|
||||
Icon: IconMail,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'companyId',
|
||||
fieldMetadataId: 'companyId',
|
||||
label: 'Company',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'ENTITY',
|
||||
@ -39,19 +39,19 @@ export const personTableFilterDefinitions: FilterDefinitionByEntity<Person>[] =
|
||||
entitySelectComponent: <FilterDropdownCompanySearchSelect />,
|
||||
},
|
||||
{
|
||||
fieldId: 'phone',
|
||||
fieldMetadataId: 'phone',
|
||||
label: 'Phone',
|
||||
Icon: IconPhone,
|
||||
type: 'TEXT',
|
||||
},
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Created at',
|
||||
Icon: IconCalendarEvent,
|
||||
type: 'DATE',
|
||||
},
|
||||
{
|
||||
fieldId: 'city',
|
||||
fieldMetadataId: 'city',
|
||||
label: 'City',
|
||||
Icon: IconMap,
|
||||
type: 'TEXT',
|
||||
|
||||
@ -11,7 +11,7 @@ import { SortDirection } from '@/ui/object/object-sort-dropdown/types/SortDirect
|
||||
|
||||
export const personTableSortDefinitions: SortDefinition[] = [
|
||||
{
|
||||
fieldId: 'fullname',
|
||||
fieldMetadataId: 'fullname',
|
||||
label: 'People',
|
||||
Icon: IconUser,
|
||||
|
||||
@ -21,7 +21,7 @@ export const personTableSortDefinitions: SortDefinition[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
fieldId: 'company_name',
|
||||
fieldMetadataId: 'company_name',
|
||||
label: 'Company',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
getOrderByTemplate: (direction: SortDirection) => [
|
||||
@ -29,22 +29,22 @@ export const personTableSortDefinitions: SortDefinition[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
fieldId: 'email',
|
||||
fieldMetadataId: 'email',
|
||||
label: 'Email',
|
||||
Icon: IconMail,
|
||||
},
|
||||
{
|
||||
fieldId: 'phone',
|
||||
fieldMetadataId: 'phone',
|
||||
label: 'Phone',
|
||||
Icon: IconPhone,
|
||||
},
|
||||
{
|
||||
fieldId: 'createdAt',
|
||||
fieldMetadataId: 'createdAt',
|
||||
label: 'Created at',
|
||||
Icon: IconCalendarEvent,
|
||||
},
|
||||
{
|
||||
fieldId: 'city',
|
||||
fieldMetadataId: 'city',
|
||||
label: 'City',
|
||||
Icon: IconMap,
|
||||
},
|
||||
|
||||
@ -77,7 +77,7 @@ export const SettingsNewObject = () => {
|
||||
});
|
||||
|
||||
await createOneView?.({
|
||||
objectId: createdObject.data?.createOneObject.id,
|
||||
objectMetadataId: createdObject.data?.createOneObject.id,
|
||||
type: ViewType.Table,
|
||||
name: `All ${customFormValues.labelPlural}`,
|
||||
});
|
||||
|
||||
@ -72,10 +72,12 @@ export const SettingsObjectNewFieldStep1 = () => {
|
||||
|
||||
if (!activeObjectMetadataItem) return null;
|
||||
|
||||
const handleToggleField = (fieldId: string) =>
|
||||
const handleToggleField = (fieldMetadataId: string) =>
|
||||
setMetadataFields((previousFields) =>
|
||||
previousFields.map((field) =>
|
||||
field.id === fieldId ? { ...field, isActive: !field.isActive } : field,
|
||||
field.id === fieldMetadataId
|
||||
? { ...field, isActive: !field.isActive }
|
||||
: field,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
objectNamePlural: 'viewsV2',
|
||||
filter: {
|
||||
type: { eq: ViewType.Table },
|
||||
objectId: { eq: activeObjectMetadataItem?.id },
|
||||
objectMetadataId: { eq: activeObjectMetadataItem?.id },
|
||||
},
|
||||
onCompleted: async (data: PaginatedObjectTypeResults<View>) => {
|
||||
const views = data.edges;
|
||||
@ -72,12 +72,12 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
const handleSave = async () => {
|
||||
const createdField = await createMetadataField({
|
||||
...formValues,
|
||||
objectId: activeObjectMetadataItem.id,
|
||||
objectMetadataId: activeObjectMetadataItem.id,
|
||||
});
|
||||
objectViews.forEach(async (view) => {
|
||||
await createOneViewField?.({
|
||||
viewId: view.id,
|
||||
fieldId: createdField.data?.createOneField.id,
|
||||
fieldMetadataId: createdField.data?.createOneField.id,
|
||||
position: activeObjectMetadataItem.fields.length,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
|
||||
@ -18,7 +18,7 @@ export const TasksEffect = () => {
|
||||
useEffect(() => {
|
||||
if (currentUser) {
|
||||
setSelectedFilter({
|
||||
fieldId: 'assigneeId',
|
||||
fieldMetadataId: 'assigneeId',
|
||||
value: currentUser.id,
|
||||
operand: ViewFilterOperand.Is,
|
||||
displayValue: currentUser.displayName,
|
||||
|
||||
@ -5,7 +5,7 @@ import { Activity } from '~/generated/graphql';
|
||||
|
||||
export const tasksFilterDefinitions: FilterDefinitionByEntity<Activity>[] = [
|
||||
{
|
||||
fieldId: 'assigneeId',
|
||||
fieldMetadataId: 'assigneeId',
|
||||
label: 'Assignee',
|
||||
Icon: IconUser,
|
||||
type: 'ENTITY',
|
||||
|
||||
Reference in New Issue
Block a user