00dd046798
Closes #2171
18 lines
552 B
TypeScript
18 lines
552 B
TypeScript
import toCamelCase from 'lodash.camelcase';
|
|
import upperFirst from 'lodash.upperfirst';
|
|
|
|
import { ObjectFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType';
|
|
import { Field } from '~/generated-metadata/graphql';
|
|
|
|
export const formatMetadataFieldInput = (
|
|
input: Pick<Field, 'label' | 'icon' | 'description'> & {
|
|
type: ObjectFieldDataType;
|
|
},
|
|
) => ({
|
|
description: input.description?.trim() ?? null,
|
|
icon: input.icon,
|
|
label: input.label.trim(),
|
|
name: upperFirst(toCamelCase(input.label.trim())),
|
|
type: input.type,
|
|
});
|