Fix/object record and metadata naming (#2763)

* Fixed object-record and object-metadata naming

* Fix post merge

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau
2023-11-29 13:45:57 +01:00
committed by GitHub
parent 3617abb0e6
commit d855a42eca
99 changed files with 614 additions and 691 deletions

View File

@ -1,4 +1,4 @@
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { assertNotNull } from '~/utils/assert';
export const useFieldPreviewValue = ({
@ -10,12 +10,12 @@ export const useFieldPreviewValue = ({
objectNamePlural: string;
skip?: boolean;
}) => {
const { objects } = useFindManyObjectRecords({
const { records } = useFindManyRecords({
objectNamePlural,
skip,
});
const firstRecordWithValue = objects.find(
const firstRecordWithValue = records.find(
(record) => assertNotNull(record[fieldName]) && record[fieldName] !== '',
);

View File

@ -1,5 +1,5 @@
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
export const useRelationFieldPreviewValue = ({
relationObjectMetadataId,
@ -14,7 +14,7 @@ export const useRelationFieldPreviewValue = ({
? findObjectMetadataItemById(relationObjectMetadataId)
: undefined;
const { objects: relationObjects } = useFindManyObjectRecords({
const { records: relationObjects } = useFindManyRecords({
objectNamePlural: relationObjectMetadataItem?.namePlural,
skip: skip || !relationObjectMetadataItem,
});

View File

@ -3,7 +3,7 @@ import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { Tag } from '@/ui/display/tag/components/Tag';
import { useLazyLoadIcon } from '@/ui/input/hooks/useLazyLoadIcon';
import { TableCell } from '@/ui/layout/table/components/TableCell';
@ -36,7 +36,7 @@ export const SettingsObjectItemTableRow = ({
}: SettingsObjectItemTableRowProps) => {
const theme = useTheme();
const { objects } = useFindManyObjectRecords({
const { records } = useFindManyRecords({
objectNamePlural: objectItem.namePlural,
});
@ -58,7 +58,7 @@ export const SettingsObjectItemTableRow = ({
<TableCell align="right">
{objectItem.fields.filter((field) => !field.isSystem).length}
</TableCell>
<TableCell align="right">{objects.length}</TableCell>
<TableCell align="right">{records.length}</TableCell>
<StyledActionTableCell>{action}</StyledActionTableCell>
</StyledObjectTableRow>
);