feat: refactor schema builder and resolver builder (#2215)
* feat: wip refactor schema builder * feat: wip store types and first queries generation * feat: refactor schema-builder and resolver-builder * fix: clean & small type fix * fix: avoid breaking change * fix: remove util from pg-graphql classes * fix: required default fields * Refactor frontend accordingly --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -12,7 +12,7 @@ type SettingsObjectFieldTypeSelectSectionProps = {
|
||||
};
|
||||
|
||||
// TODO: remove "relation" type for now, add it back when the backend is ready.
|
||||
const { relation: _, ...dataTypesWithoutRelation } = dataTypes;
|
||||
const { RELATION: _, ...dataTypesWithoutRelation } = dataTypes;
|
||||
|
||||
export const SettingsObjectFieldTypeSelectSection = ({
|
||||
disabled,
|
||||
|
||||
@ -9,7 +9,7 @@ const meta: Meta<typeof SettingsObjectFieldTypeSelectSection> = {
|
||||
title: 'Modules/Settings/DataModel/SettingsObjectFieldTypeSelectSection',
|
||||
component: SettingsObjectFieldTypeSelectSection,
|
||||
decorators: [ComponentDecorator],
|
||||
args: { type: 'number' },
|
||||
args: { type: 'NUMBER' },
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
@ -13,9 +13,9 @@ export const dataTypes: Record<
|
||||
MetadataFieldDataType,
|
||||
{ label: string; Icon: IconComponent }
|
||||
> = {
|
||||
number: { label: 'Number', Icon: IconNumbers },
|
||||
text: { label: 'Text', Icon: IconTextSize },
|
||||
url: { label: 'Link', Icon: IconLink },
|
||||
boolean: { label: 'True/False', Icon: IconCheck },
|
||||
relation: { label: 'Relation', Icon: IconPlug },
|
||||
NUMBER: { label: 'Number', Icon: IconNumbers },
|
||||
TEXT: { label: 'Text', Icon: IconTextSize },
|
||||
URL: { label: 'Link', Icon: IconLink },
|
||||
BOOLEAN: { label: 'True/False', Icon: IconCheck },
|
||||
RELATION: { label: 'Relation', Icon: IconPlug },
|
||||
};
|
||||
|
||||
@ -15,7 +15,7 @@ const StyledDataType = styled.div<{ value: MetadataFieldDataType }>`
|
||||
padding: 0 ${({ theme }) => theme.spacing(2)};
|
||||
|
||||
${({ theme, value }) =>
|
||||
value === 'relation'
|
||||
value === 'RELATION'
|
||||
? css`
|
||||
border-color: ${theme.color.purple20};
|
||||
color: ${theme.color.purple};
|
||||
|
||||
@ -39,10 +39,10 @@ export const SettingsObjectFieldItemTableRow = ({
|
||||
|
||||
// TODO: parse with zod and merge types with FieldType (create a subset of FieldType for example)
|
||||
const fieldDataTypeIsSupported = [
|
||||
'text',
|
||||
'number',
|
||||
'boolean',
|
||||
'url',
|
||||
'TEXT',
|
||||
'NUMBER',
|
||||
'BOOLEAN',
|
||||
'URL',
|
||||
].includes(fieldItem.type);
|
||||
|
||||
if (!fieldDataTypeIsSupported) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export type MetadataFieldDataType =
|
||||
| 'boolean'
|
||||
| 'number'
|
||||
| 'relation'
|
||||
| 'text'
|
||||
| 'url';
|
||||
| 'BOOLEAN'
|
||||
| 'NUMBER'
|
||||
| 'RELATION'
|
||||
| 'TEXT'
|
||||
| 'URL';
|
||||
|
||||
Reference in New Issue
Block a user