Replace all hardcoded core object name by enum (#3170)

* Replace hardcoded core object name by enum

Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com>

* Fix typo

Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com>

* Fixed duplicate import

---------

Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
flox_x 2023-12-29 15:11:30 +01:00 committed by GitHub
parent c422045ea6
commit fd607789f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 150 additions and 82 deletions

View File

@ -11,6 +11,7 @@ import { BlockEditor } from '@/ui/input/editor/components/BlockEditor';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledBlockNoteStyledContainer = styled.div`
width: 100%;
@ -27,7 +28,7 @@ export const ActivityBodyEditor = ({
}: ActivityBodyEditorProps) => {
const [body, setBody] = useState<string | null>(null);
const { updateOneRecord } = useUpdateOneRecord({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
});
useEffect(() => {

View File

@ -14,6 +14,7 @@ import {
AutosizeTextInputVariant,
} from '@/ui/input/components/AutosizeTextInput';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledThreadItemListContainer = styled.div`
align-items: flex-start;
@ -61,13 +62,13 @@ export const ActivityComments = ({
scrollableContainerRef,
}: ActivityCommentsProps) => {
const { createOneRecord: createOneComment } = useCreateOneRecord({
objectNameSingular: 'comment',
objectNameSingular: CoreObjectNameSingular.Comment,
});
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
const { records: comments } = useFindManyRecords({
objectNameSingular: 'comment',
objectNameSingular: CoreObjectNameSingular.Comment,
filter: {
activityId: {
eq: activity?.id ?? '',

View File

@ -9,6 +9,7 @@ import { Activity } from '@/activities/types/Activity';
import { ActivityTarget } from '@/activities/types/ActivityTarget';
import { Comment } from '@/activities/types/Comment';
import { GraphQLActivity } from '@/activities/types/GraphQLActivity';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useFieldContext } from '@/object-record/hooks/useFieldContext';
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell';
@ -81,11 +82,11 @@ export const ActivityEditor = ({
const containerRef = useRef<HTMLDivElement>(null);
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord<Activity>({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
});
const { FieldContextProvider: DueAtFieldContextProvider } = useFieldContext({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
objectRecordId: activity.id,
fieldMetadataName: 'dueAt',
fieldPosition: 0,
@ -93,7 +94,7 @@ export const ActivityEditor = ({
const { FieldContextProvider: AssigneeFieldContextProvider } =
useFieldContext({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
objectRecordId: activity.id,
fieldMetadataName: 'assignee',
fieldPosition: 1,

View File

@ -14,6 +14,7 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
import { IconCalendar } from '@/ui/display/icon';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { formatToHumanReadableDate } from '~/utils';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledRow = styled.div`
align-items: center;
@ -63,7 +64,7 @@ export const AttachmentRow = ({ attachment }: { attachment: Attachment }) => {
const { deleteOneRecord: deleteOneAttachment } =
useDeleteOneRecord<Attachment>({
objectNameSingular: 'attachment',
objectNameSingular: CoreObjectNameSingular.Attachment,
});
const handleDelete = () => {

View File

@ -12,6 +12,7 @@ import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
import { IconPlus } from '@/ui/display/icon';
import { Button } from '@/ui/input/button/components/Button';
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledTaskGroupEmptyContainer = styled.div`
align-items: center;
@ -67,7 +68,7 @@ export const Attachments = ({
const { createOneRecord: createOneAttachment } =
useCreateOneRecord<Attachment>({
objectNameSingular: 'attachment',
objectNameSingular: CoreObjectNameSingular.Attachment,
});
const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {

View File

@ -2,11 +2,12 @@ import { Attachment } from '@/activities/files/types/Attachment';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
// do we need to test this?
export const useAttachments = (entity: ActivityTargetableEntity) => {
const { records: attachments } = useFindManyRecords({
objectNameSingular: 'attachment',
objectNameSingular: CoreObjectNameSingular.Attachment,
filter: {
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
},

View File

@ -1,4 +1,5 @@
import { ActivityTarget } from '@/activities/types/ActivityTarget';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
@ -11,10 +12,10 @@ export const useHandleCheckableActivityTargetChange = ({
}) => {
const { createOneRecord: createOneActivityTarget } =
useCreateOneRecord<ActivityTarget>({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
});
const { deleteOneRecord: deleteOneActivityTarget } = useDeleteOneRecord({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
});
return async (

View File

@ -15,15 +15,16 @@ import { activityTargetableEntityArrayState } from '../states/activityTargetable
import { viewableActivityIdState } from '../states/viewableActivityIdState';
import { ActivityTargetableEntity } from '../types/ActivityTargetableEntity';
import { getTargetableEntitiesWithParents } from '../utils/getTargetableEntitiesWithParents';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useOpenCreateActivityDrawer = () => {
const { openRightDrawer } = useRightDrawer();
const { createOneRecord: createOneActivityTarget } =
useCreateOneRecord<ActivityTarget>({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
});
const { createOneRecord: createOneActivity } = useCreateOneRecord<Activity>({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
});
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
const setHotkeyScope = useSetHotkeyScope();

View File

@ -11,6 +11,7 @@ import { MultipleEntitySelect } from '@/object-record/relation-picker/components
import { useRelationPicker } from '@/object-record/relation-picker/hooks/useRelationPicker';
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
import { assertNotNull } from '~/utils/assert';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
type ActivityTargetInlineCellEditModeProps = {
activityId: string;
@ -56,12 +57,12 @@ export const ActivityTargetInlineCellEditMode = ({
);
const { findManyRecordsQuery: findManyPeopleQuery } = useObjectMetadataItem({
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
});
const { findManyRecordsQuery: findManyCompaniesQuery } =
useObjectMetadataItem({
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
});
const useFindManyPeopleQuery = (options: any) =>
@ -87,7 +88,7 @@ export const ActivityTargetInlineCellEditMode = ({
orderByField: 'createdAt',
mappingFunction: (record: any) => identifiersMapper?.(record, 'person'),
selectedIds: initialPeopleIds,
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
limit: 3,
});
@ -102,7 +103,7 @@ export const ActivityTargetInlineCellEditMode = ({
orderByField: 'createdAt',
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
selectedIds: initialCompanyIds,
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
limit: 3,
});

View File

@ -2,6 +2,7 @@ import { ActivityTargetChips } from '@/activities/components/ActivityTargetChips
import { ActivityTargetInlineCellEditMode } from '@/activities/inline-cell/components/ActivityTargetInlineCellEditMode';
import { ActivityTarget } from '@/activities/types/ActivityTarget';
import { GraphQLActivity } from '@/activities/types/GraphQLActivity';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { RecordInlineCellContainer } from '@/object-record/record-inline-cell/components/RecordInlineCellContainer';
import { FieldRecoilScopeContext } from '@/object-record/record-inline-cell/states/recoil-scope-contexts/FieldRecoilScopeContext';
@ -28,7 +29,7 @@ export const ActivityTargetsInlineCell = ({
) ?? [];
const { records: activityTargets } = useFindManyRecords<ActivityTarget>({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
filter: { id: { in: activityTargetIds } },
});

View File

@ -3,10 +3,11 @@ import { OrderByField } from '@/object-metadata/types/OrderByField';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useNotes = (entity: ActivityTargetableEntity) => {
const { records: activityTargets } = useFindManyRecords({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
filter: {
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
},
@ -24,7 +25,7 @@ export const useNotes = (entity: ActivityTargetableEntity) => {
const { records: notes } = useFindManyRecords({
skip: !activityTargets?.length,
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
filter,
orderBy,
});

View File

@ -4,6 +4,7 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
import { IconTrash } from '@/ui/display/icon';
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
type ActivityActionBarProps = {
activityId: string;
@ -12,7 +13,7 @@ type ActivityActionBarProps = {
export const ActivityActionBar = ({ activityId }: ActivityActionBarProps) => {
const [, setIsRightDrawerOpen] = useRecoilState(isRightDrawerOpenState);
const { deleteOneRecord: deleteOneActivity } = useDeleteOneRecord({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
refetchFindManyQuery: true,
});

View File

@ -8,6 +8,7 @@ import { entityFieldsFamilyState } from '@/object-record/field/states/entityFiel
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
import '@blocknote/core/style.css';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledContainer = styled.div`
box-sizing: border-box;
@ -35,7 +36,7 @@ export const RightDrawerActivity = ({
);
const { record: activity } = useFindOneRecord({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
objectRecordId: activityId,
skip: !activityId,
onCompleted: (activity: Activity) => {

View File

@ -13,6 +13,7 @@ import { Checkbox, CheckboxShape } from '@/ui/input/components/Checkbox';
import { beautifyExactDate, hasDatePassed } from '~/utils/date-utils';
import { useCompleteTask } from '../hooks/useCompleteTask';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledContainer = styled.div`
align-items: center;
@ -81,7 +82,7 @@ export const TaskRow = ({
) ?? [];
const { records: activityTargets } = useFindManyRecords<ActivityTarget>({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
filter: { id: { in: activityTargetIds } },
});

View File

@ -2,12 +2,13 @@ import { useCallback } from 'react';
import { Activity } from '@/activities/types/Activity';
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
type Task = Pick<Activity, 'id' | 'completedAt'>;
export const useCompleteTask = (task: Task) => {
const { updateOneRecord: updateOneActivity } = useUpdateOneRecord<Activity>({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
});
const completeTask = useCallback(

View File

@ -4,12 +4,13 @@ import { useRecoilValue } from 'recoil';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { parseDate } from '~/utils/date-utils';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useCurrentUserTaskCount = () => {
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
const { records: tasks } = useFindManyRecords({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
filter: {
type: { eq: 'Task' },
completedAt: { is: 'NULL' },

View File

@ -7,6 +7,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { useFilterDropdown } from '@/object-record/object-filter-dropdown/hooks/useFilterDropdown';
import { parseDate } from '~/utils/date-utils';
import { isDefined } from '~/utils/isDefined';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
type UseTasksProps = {
filterDropdownId?: string;
@ -21,7 +22,7 @@ export const useTasks = (props?: UseTasksProps) => {
});
const { records: activityTargets } = useFindManyRecords({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
filter: isDefined(entity)
? {
[entity?.type === 'Company' ? 'companyId' : 'personId']: {
@ -32,7 +33,7 @@ export const useTasks = (props?: UseTasksProps) => {
});
const { records: completeTasksData } = useFindManyRecords({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
skip: !entity && !selectedFilter,
filter: {
completedAt: { is: 'NOT_NULL' },
@ -56,7 +57,7 @@ export const useTasks = (props?: UseTasksProps) => {
});
const { records: incompleteTaskData } = useFindManyRecords({
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
skip: !entity && !selectedFilter,
filter: {
completedAt: { is: 'NULL' },

View File

@ -9,6 +9,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { TimelineItemsContainer } from './TimelineItemsContainer';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledMainContainer = styled.div`
align-items: flex-start;
@ -49,7 +50,7 @@ const StyledEmptyTimelineSubTitle = styled.div`
export const Timeline = ({ entity }: { entity: ActivityTargetableEntity }) => {
const { records: activityTargets, loading } = useFindManyRecords({
objectNameSingular: 'activityTarget',
objectNameSingular: CoreObjectNameSingular.ActivityTarget,
filter: {
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
},
@ -57,7 +58,7 @@ export const Timeline = ({ entity }: { entity: ActivityTargetableEntity }) => {
const { records: activities } = useFindManyRecords({
skip: !activityTargets?.length,
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
filter: {
id: {
in: activityTargets?.map((activityTarget) => activityTarget.activityId),

View File

@ -26,6 +26,7 @@ import { Command, CommandType } from '../types/Command';
import { CommandGroup } from './CommandGroup';
import { CommandMenuItem } from './CommandMenuItem';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const StyledDialog = styled.div`
background: ${({ theme }) => theme.background.secondary};
@ -132,7 +133,7 @@ export const CommandMenu = () => {
const { records: people } = useFindManyRecords<Person>({
skip: !isCommandMenuOpened,
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
filter: {
or: [
{ name: { firstName: { ilike: `%${search}%` } } },
@ -144,7 +145,7 @@ export const CommandMenu = () => {
const { records: companies } = useFindManyRecords<Company>({
skip: !isCommandMenuOpened,
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
filter: {
name: { ilike: `%${search}%` },
},
@ -153,7 +154,7 @@ export const CommandMenu = () => {
const { records: activities } = useFindManyRecords<Activity>({
skip: !isCommandMenuOpened,
objectNameSingular: 'activity',
objectNameSingular: CoreObjectNameSingular.Activity,
filter: {
or: [
{ title: { like: `%${search}%` } },

View File

@ -16,6 +16,7 @@ import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledContainer = styled.div`
position: static;
@ -73,7 +74,7 @@ export const AddPersonToCompany = ({
updateOneRecordMutation,
createOneRecordMutation,
} = useObjectMetadataItem({
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
});
const [updatePerson] = useMutation(updateOneRecordMutation);

View File

@ -24,6 +24,7 @@ import { getLogoUrlFromDomainName } from '~/utils';
import { companyProgressesFamilyState } from '../states/companyProgressesFamilyState';
import { CompanyChip } from './CompanyChip';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledBoardCard = styled.div<{ selected: boolean }>`
background-color: ${({ theme, selected }) =>
@ -151,7 +152,7 @@ export const CompanyBoardCard = () => {
const useUpdateOneRecordMutation: RecordUpdateHook = () => {
const { updateOneRecord: updateOneOpportunity } = useUpdateOneRecord({
objectNameSingular: 'opportunity',
objectNameSingular: CoreObjectNameSingular.Opportunity,
});
const updateEntity = ({ variables }: RecordUpdateHookParams) => {

View File

@ -8,6 +8,7 @@ import { mapPaginatedRecordsToRecords } from '@/object-record/utils/mapPaginated
import { PeopleCard } from '@/people/components/PeopleCard';
import { AddPersonToCompany } from './AddPersonToCompany';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export type CompanyTeamProps = {
company: Pick<Company, 'id'>;
@ -48,7 +49,7 @@ const StyledTitle = styled.div`
export const CompanyTeam = ({ company }: { company: any }) => {
const { findManyRecordsQuery } = useObjectMetadataItem({
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
});
const { data } = useQuery(findManyRecordsQuery, {

View File

@ -14,6 +14,7 @@ import { useViewScopedStates } from '@/views/hooks/internal/useViewScopedStates'
import { useViewBar } from '@/views/hooks/useViewBar';
import { ViewType } from '@/views/types/ViewType';
import { mapViewFieldsToBoardFieldDefinitions } from '@/views/utils/mapViewFieldsToBoardFieldDefinitions';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
type HooksCompanyBoardEffectProps = {
viewBarId: string;
@ -33,7 +34,7 @@ export const HooksCompanyBoardEffect = ({
} = useViewBar({ viewBarId });
const { objectMetadataItem } = useObjectMetadataItem({
objectNameSingular: 'opportunity',
objectNameSingular: CoreObjectNameSingular.Opportunity,
});
const { columnDefinitions, filterDefinitions, sortDefinitions } =

View File

@ -11,6 +11,7 @@ import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types
import { useFilteredSearchEntityQuery } from '@/search/hooks/useFilteredSearchEntityQuery';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const NewOpportunityButton = () => {
const [isCreatingCard, setIsCreatingCard] = useState(false);
@ -57,7 +58,7 @@ export const NewOpportunityButton = () => {
// TODO: refactor useFilteredSearchEntityQuery
const { findManyRecordsQuery } = useObjectMetadataItem({
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
});
const useFindManyQuery = (options: any) =>
useQuery(findManyRecordsQuery, options);
@ -74,7 +75,7 @@ export const NewOpportunityButton = () => {
orderByField: 'createdAt',
selectedIds: [],
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
});
return (

View File

@ -17,6 +17,7 @@ import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/Dropdow
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export type OpportunityPickerProps = {
companyId: string | null;
@ -37,7 +38,7 @@ export const OpportunityPicker = ({
// TODO: refactor useFilteredSearchEntityQuery
const { findManyRecordsQuery: findManyCompanies } = useObjectMetadataItem({
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
});
const useFindManyQuery = (options: any) =>
useQuery(findManyCompanies, options);
@ -54,7 +55,7 @@ export const OpportunityPicker = ({
orderByField: 'createdAt',
selectedIds: [],
mappingFunction: (record: any) => identifiersMapper?.(record, 'company'),
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
});
const [isProgressSelectionUnfolded, setIsProgressSelectionUnfolded] =

View File

@ -5,6 +5,7 @@ import { SpreadsheetOptions } from '@/spreadsheet-import/types';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { fieldsForCompany } from '../utils/fieldsForCompany';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export type FieldCompanyMapping = (typeof fieldsForCompany)[number]['key'];
@ -14,7 +15,7 @@ export const useSpreadsheetCompanyImport = () => {
const { createManyRecords: createManyCompanies } =
useCreateManyRecords<Company>({
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
});
const openCompanySpreadsheetImport = (

View File

@ -14,6 +14,7 @@ import { PaginatedRecordTypeResults } from '@/object-record/types/PaginatedRecor
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
import { favoritesState } from '../states/favoritesState';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useFavorites = ({
objectNamePlural,
@ -29,11 +30,11 @@ export const useFavorites = ({
createOneRecordMutation: createOneFavoriteMutation,
deleteOneRecordMutation: deleteOneFavoriteMutation,
} = useObjectMetadataItem({
objectNameSingular: 'favorite',
objectNameSingular: CoreObjectNameSingular.Favorite,
});
const { triggerOptimisticEffects } = useOptimisticEffect({
objectNameSingular: 'favorite',
objectNameSingular: CoreObjectNameSingular.Favorite,
});
const { performOptimisticEvict } = useOptimisticEvict();
@ -49,7 +50,7 @@ export const useFavorites = ({
const apolloClient = useApolloClient();
useFindManyRecords({
objectNameSingular: 'favorite',
objectNameSingular: CoreObjectNameSingular.Favorite,
onCompleted: useRecoilCallback(
({ snapshot, set }) =>
async (data: PaginatedRecordTypeResults<Required<Favorite>>) => {

View File

@ -1,6 +1,23 @@
export enum CoreObjectNameSingular {
Activity = 'activity',
ActivityTarget = 'activityTarget',
ApiKey = 'apiKey',
Attachment = 'attachment',
Comment = 'comment',
Company = 'company',
Person = 'person',
WorkspaceMember = 'workspaceMember',
ConenctedAccount = 'conenctedAccount',
Favorite = 'favorite',
Message = 'message',
MessageChannel = 'messageChannel',
MessageRecipient = 'messageRecipient',
MessageThread = 'messageThread',
Opportunity = 'opportunity',
Person = 'person',
PipelineStep = 'pipelineStep',
View = 'view',
ViewField = 'viewField',
ViewFilter = 'viewFilter',
ViewSort = 'viewSort',
Webhook = 'webhook',
WorkspaceMember = 'workspaceMember',
}

View File

@ -11,6 +11,7 @@ import { Opportunity } from '@/pipeline/types/Opportunity';
import { PipelineStep } from '@/pipeline/types/PipelineStep';
import { useFindManyRecords } from './useFindManyRecords';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useObjectRecordBoard = () => {
const objectNameSingular = 'opportunity';
@ -53,7 +54,7 @@ export const useObjectRecordBoard = () => {
);
useFindManyRecords({
objectNameSingular: 'pipelineStep',
objectNameSingular: CoreObjectNameSingular.PipelineStep,
filter: {},
onCompleted: useCallback(
(data: PaginatedRecordTypeResults<PipelineStep>) => {
@ -69,7 +70,7 @@ export const useObjectRecordBoard = () => {
fetchMoreRecords: fetchMoreOpportunities,
} = useFindManyRecords<Opportunity>({
skip: !savedPipelineSteps.length,
objectNameSingular: 'opportunity',
objectNameSingular: CoreObjectNameSingular.Opportunity,
filter,
orderBy,
onCompleted: useCallback(() => {
@ -79,7 +80,7 @@ export const useObjectRecordBoard = () => {
const { fetchMoreRecords: fetchMoreCompanies } = useFindManyRecords({
skip: !savedOpportunities.length,
objectNameSingular: 'company',
objectNameSingular: CoreObjectNameSingular.Company,
filter: {
id: {
in: savedOpportunities.map(

View File

@ -22,6 +22,7 @@ import { BoardColumnDefinition } from '../types/BoardColumnDefinition';
import { BoardOptions } from '../types/BoardOptions';
import { RecordBoardColumn } from './RecordBoardColumn';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export type RecordBoardProps = {
recordBoardId: string;
@ -73,7 +74,7 @@ export const RecordBoard = ({
const { updateOneRecord: updateOneOpportunity } =
useUpdateOneRecord<Opportunity>({
objectNameSingular: 'opportunity',
objectNameSingular: CoreObjectNameSingular.Opportunity,
});
const { unselectAllActiveCards, setCardSelected } =

View File

@ -4,11 +4,12 @@ import { v4 } from 'uuid';
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
import { recordBoardCardIdsByColumnIdFamilyState } from '@/object-record/record-board/states/recordBoardCardIdsByColumnIdFamilyState';
import { Opportunity } from '@/pipeline/types/Opportunity';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useCreateOpportunity = () => {
const { createOneRecord: createOneOpportunity } =
useCreateOneRecord<Opportunity>({
objectNameSingular: 'opportunity',
objectNameSingular: CoreObjectNameSingular.Opportunity,
});
const createOpportunity = useRecoilCallback(

View File

@ -6,6 +6,7 @@ import { useRecordBoardScopedStates } from '@/object-record/record-board/hooks/i
import { Opportunity } from '@/pipeline/types/Opportunity';
import { useRemoveRecordBoardCardIdsInternal } from './useRemoveRecordBoardCardIdsInternal';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useDeleteSelectedRecordBoardCardsInternal = () => {
const removeCardIds = useRemoveRecordBoardCardIdsInternal();
@ -13,7 +14,7 @@ export const useDeleteSelectedRecordBoardCardsInternal = () => {
const { deleteManyRecords: deleteManyOpportunities } =
useDeleteManyRecords<Opportunity>({
objectNameSingular: 'opportunity',
objectNameSingular: CoreObjectNameSingular.Opportunity,
});
const { selectedCardIdsSelector } = useRecordBoardScopedStates();

View File

@ -6,6 +6,7 @@ import { PipelineStep } from '@/pipeline/types/PipelineStep';
import { useMoveViewColumns } from '@/views/hooks/useMoveViewColumns';
import { BoardColumnDefinition } from '../../types/BoardColumnDefinition';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useBoardColumnsInternal = () => {
const { boardColumnsState } = useRecordBoardScopedStates();
@ -15,7 +16,7 @@ export const useBoardColumnsInternal = () => {
const { updateOneRecord: updateOnePipelineStep } =
useUpdateOneRecord<PipelineStep>({
objectNameSingular: 'pipelineStep',
objectNameSingular: CoreObjectNameSingular.PipelineStep,
});
const updatedPipelineSteps = (stages: BoardColumnDefinition[]) => {

View File

@ -14,6 +14,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { Avatar } from '@/users/components/Avatar';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export type PeopleCardProps = {
person: Pick<Person, 'id' | 'avatarUrl' | 'name' | 'jobTitle'>;
@ -112,7 +113,7 @@ export const PeopleCard = ({
updateOneRecordMutation,
deleteOneRecordMutation,
} = useObjectMetadataItem({
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
});
const [updatePerson] = useMutation(updateOneRecordMutation);

View File

@ -7,6 +7,7 @@ import { SpreadsheetOptions } from '@/spreadsheet-import/types';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { fieldsForPerson } from '../utils/fieldsForPerson';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export type FieldPersonMapping = (typeof fieldsForPerson)[number]['key'];
@ -15,7 +16,7 @@ export const useSpreadsheetPersonImport = () => {
const { enqueueSnackBar } = useSnackBar();
const { createManyRecords: createManyPeople } = useCreateManyRecords<Person>({
objectNameSingular: 'person',
objectNameSingular: CoreObjectNameSingular.Person,
});
const openPersonSpreadsheetImport = (

View File

@ -5,16 +5,17 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
import { BoardColumnDefinition } from '@/object-record/record-board/types/BoardColumnDefinition';
import { currentPipelineState } from '@/pipeline/states/currentPipelineState';
import { PipelineStep } from '@/pipeline/types/PipelineStep';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const usePipelineSteps = () => {
const { createOneRecord: createOnePipelineStep } =
useCreateOneRecord<PipelineStep>({
objectNameSingular: 'pipelineStep',
objectNameSingular: CoreObjectNameSingular.PipelineStep,
});
const { deleteOneRecord: deleteOnePipelineStep } =
useDeleteOneRecord<PipelineStep>({
objectNameSingular: 'pipelineStep',
objectNameSingular: CoreObjectNameSingular.PipelineStep,
});
const handlePipelineStepAdd = useRecoilCallback(

View File

@ -1,4 +1,5 @@
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
export const useRelationFieldPreviewValue = ({
@ -16,7 +17,7 @@ export const useRelationFieldPreviewValue = ({
: undefined;
const { records: relationObjects } = useFindManyRecords({
objectNameSingular: relationObjectMetadataItem?.nameSingular ?? 'company', // TODO fix this hack
objectNameSingular: relationObjectMetadataItem?.nameSingular ?? CoreObjectNameSingular.Company, // TODO fix this hack
skip: skip || !relationObjectMetadataItem,
});

View File

@ -8,6 +8,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembe
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { TextInput } from '@/ui/input/components/TextInput';
import { logError } from '~/utils/logError';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledComboInputContainer = styled.div`
display: flex;
@ -41,7 +42,7 @@ export const NameFields = ({
);
const { updateOneRecord } = useUpdateOneRecord({
objectNameSingular: 'workspaceMember',
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
});
// TODO: Enhance this with react-web-hook-form (https://www.react-hook-form.com)

View File

@ -6,6 +6,7 @@ import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { ImageInput } from '@/ui/input/components/ImageInput';
import { getImageAbsoluteURIOrBase64 } from '@/users/utils/getProfilePictureAbsoluteURI';
import { useUploadProfilePictureMutation } from '~/generated/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const ProfilePictureUploader = () => {
const [uploadPicture, { loading: isUploading }] =
@ -20,7 +21,7 @@ export const ProfilePictureUploader = () => {
const [errorMessage, setErrorMessage] = useState<string | null>(null);
const { updateOneRecord } = useUpdateOneRecord({
objectNameSingular: 'workspaceMember',
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
});
const handleUpload = async (file: File) => {

View File

@ -4,6 +4,7 @@ import { useRecoilState } from 'recoil';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useColorScheme = () => {
const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilState(
@ -11,7 +12,7 @@ export const useColorScheme = () => {
);
const { updateOneRecord: updateOneWorkspaceMember } = useUpdateOneRecord({
objectNameSingular: 'workspaceMember',
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
});
const colorScheme = currentWorkspaceMember?.colorScheme ?? 'System';

View File

@ -8,6 +8,7 @@ import { GraphQLView } from '@/views/types/GraphQLView';
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
import { useViewScopedStates } from '../hooks/internal/useViewScopedStates';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const ViewBarEffect = () => {
const {
@ -35,7 +36,7 @@ export const ViewBarEffect = () => {
const { records: newViews } = useFindManyRecords<GraphQLView>({
skip: !viewObjectMetadataId,
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
filter: {
type: { eq: viewType },
objectMetadataId: { eq: viewObjectMetadataId },

View File

@ -5,15 +5,16 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
import { ViewField } from '@/views/types/ViewField';
import { getViewScopedStatesFromSnapshot } from '@/views/utils/getViewScopedStatesFromSnapshot';
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useViewFields = (viewScopeId: string) => {
const { updateOneRecordMutation, createOneRecordMutation } =
useObjectMetadataItem({
objectNameSingular: 'viewField',
objectNameSingular: CoreObjectNameSingular.ViewField,
});
const { modifyRecordFromCache } = useObjectMetadataItem({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
});
const apolloClient = useApolloClient();

View File

@ -9,6 +9,7 @@ import { ViewFilter } from '@/views/types/ViewFilter';
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
import { useViewScopedStates } from './useViewScopedStates';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useViewFilters = (viewScopeId: string) => {
const {
@ -16,11 +17,11 @@ export const useViewFilters = (viewScopeId: string) => {
createOneRecordMutation,
deleteOneRecordMutation,
} = useObjectMetadataItem({
objectNameSingular: 'viewFilter',
objectNameSingular: CoreObjectNameSingular.ViewFilter,
});
const { modifyRecordFromCache } = useObjectMetadataItem({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
});
const apolloClient = useApolloClient();

View File

@ -9,6 +9,7 @@ import { ViewSort } from '@/views/types/ViewSort';
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
import { useViewScopedStates } from './useViewScopedStates';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useViewSorts = (viewScopeId: string) => {
const {
@ -16,11 +17,11 @@ export const useViewSorts = (viewScopeId: string) => {
createOneRecordMutation,
deleteOneRecordMutation,
} = useObjectMetadataItem({
objectNameSingular: 'viewSort',
objectNameSingular: CoreObjectNameSingular.ViewSort,
});
const { modifyRecordFromCache } = useObjectMetadataItem({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
});
const apolloClient = useApolloClient();

View File

@ -4,6 +4,7 @@ import { useRecoilCallback } from 'recoil';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { GraphQLView } from '@/views/types/GraphQLView';
import { getViewScopedStateValuesFromSnapshot } from '@/views/utils/getViewScopedStateValuesFromSnapshot';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const useViews = (scopeId: string) => {
const {
@ -12,7 +13,7 @@ export const useViews = (scopeId: string) => {
deleteOneRecordMutation: deleteOneMutation,
findManyRecordsQuery: findManyQuery,
} = useObjectMetadataItem({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
});
const apolloClient = useApolloClient();

View File

@ -21,6 +21,7 @@ import { MainButton } from '@/ui/input/button/components/MainButton';
import { TextInput } from '@/ui/input/components/TextInput';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledContentContainer = styled.div`
width: 100%;
@ -63,7 +64,7 @@ export const CreateProfile = () => {
);
const { updateOneRecord } = useUpdateOneRecord<WorkspaceMember>({
objectNameSingular: 'workspaceMember',
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
});
// Form

View File

@ -9,6 +9,7 @@ import { IconTargetArrow } from '@/ui/display/icon';
import { PageBody } from '@/ui/layout/page/PageBody';
import { PageContainer } from '@/ui/layout/page/PageContainer';
import { PageHeader } from '@/ui/layout/page/PageHeader';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledBoardContainer = styled.div`
display: flex;
@ -22,7 +23,7 @@ export const Opportunities = () => {
const { updateOneRecord: updateOnePipelineStep } =
useUpdateOneRecord<PipelineStep>({
objectNameSingular: 'pipelineStep',
objectNameSingular: CoreObjectNameSingular.PipelineStep,
});
const handleEditColumnTitle = ({

View File

@ -16,6 +16,7 @@ import { Section } from '@/ui/layout/section/components/Section';
import { WorkspaceInviteLink } from '@/workspace/components/WorkspaceInviteLink';
import { WorkspaceMemberCard } from '@/workspace/components/WorkspaceMemberCard';
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledH1Title = styled(H1Title)`
margin-bottom: 0;
@ -35,11 +36,11 @@ export const SettingsWorkspaceMembers = () => {
>();
const { records: workspaceMembers } = useFindManyRecords<WorkspaceMember>({
objectNameSingular: 'workspaceMember',
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
});
const { deleteOneRecord: deleteOneWorkspaceMember } =
useDeleteOneRecord<WorkspaceMember>({
objectNameSingular: 'workspaceMember',
objectNameSingular: CoreObjectNameSingular.WorkspaceMember,
});
const currentWorkspace = useRecoilValue(currentWorkspaceState);

View File

@ -22,6 +22,7 @@ import { View } from '@/views/types/View';
import { ViewType } from '@/views/types/ViewType';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const SettingsObjectNewFieldStep2 = () => {
const navigate = useNavigate();
@ -83,11 +84,11 @@ export const SettingsObjectNewFieldStep2 = () => {
const [relationObjectViews, setRelationObjectViews] = useState<View[]>([]);
const { modifyRecordFromCache: modifyViewFromCache } = useObjectMetadataItem({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
});
useFindManyRecords({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
filter: {
type: { eq: ViewType.Table },
objectMetadataId: { eq: activeObjectMetadataItem?.id },
@ -102,7 +103,7 @@ export const SettingsObjectNewFieldStep2 = () => {
});
useFindManyRecords({
objectNameSingular: 'view',
objectNameSingular: CoreObjectNameSingular.View,
skip: !formValues.relation?.objectMetadataId,
filter: {
type: { eq: ViewType.Table },

View File

@ -24,6 +24,7 @@ import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'
import { Section } from '@/ui/layout/section/components/Section';
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledInfo = styled.span`
color: ${({ theme }) => theme.font.color.light};
@ -51,14 +52,14 @@ export const SettingsDevelopersApiKeyDetail = () => {
const [generateOneApiKeyToken] = useGenerateApiKeyTokenMutation();
const { createOneRecord: createOneApiKey } = useCreateOneRecord<ApiKey>({
objectNameSingular: 'apiKey',
objectNameSingular: CoreObjectNameSingular.ApiKey,
});
const { updateOneRecord: updateApiKey } = useUpdateOneRecord<ApiKey>({
objectNameSingular: 'apiKey',
objectNameSingular: CoreObjectNameSingular.ApiKey,
});
const { record: apiKeyData } = useFindOneRecord({
objectNameSingular: 'apiKey',
objectNameSingular: CoreObjectNameSingular.ApiKey,
objectRecordId: apiKeyId,
});

View File

@ -15,6 +15,7 @@ import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'
import { Table } from '@/ui/layout/table/components/Table';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
const StyledContainer = styled.div`
height: fit-content;
@ -43,7 +44,7 @@ export const SettingsDevelopersApiKeys = () => {
const [apiKeys, setApiKeys] = useState<Array<ApiFieldItem>>([]);
useFindManyRecords({
objectNameSingular: 'apiKey',
objectNameSingular: CoreObjectNameSingular.ApiKey,
filter: { revokedAt: { is: 'NULL' } },
orderBy: {},
onCompleted: (data) => {

View File

@ -17,6 +17,7 @@ import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'
import { Section } from '@/ui/layout/section/components/Section';
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
import { useGenerateApiKeyTokenMutation } from '~/generated/graphql';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
export const SettingsDevelopersApiKeysNew = () => {
const [generateOneApiKeyToken] = useGenerateApiKeyTokenMutation();
@ -31,7 +32,7 @@ export const SettingsDevelopersApiKeysNew = () => {
});
const { createOneRecord: createOneApiKey } = useCreateOneRecord<ApiKey>({
objectNameSingular: 'apiKey',
objectNameSingular: CoreObjectNameSingular.ApiKey,
});
const onSave = async () => {