Remove singular/plural from field-metadata (#2085)
* Remove singular/plural from field-metadata * revert removing id from create input * remove console log * remove console log * codegen * missing files * fix tests
This commit is contained in:
@ -14,8 +14,8 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|||||||
*/
|
*/
|
||||||
const documents = {
|
const documents = {
|
||||||
"\n mutation CreateOneObject($input: CreateOneObjectInput!) {\n createOneObject(input: $input) {\n id\n }\n }\n": types.CreateOneObjectDocument,
|
"\n mutation CreateOneObject($input: CreateOneObjectInput!) {\n createOneObject(input: $input) {\n id\n }\n }\n": types.CreateOneObjectDocument,
|
||||||
"\n mutation CreateOneField($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.CreateOneFieldDocument,
|
"\n mutation CreateOneField($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.CreateOneFieldDocument,
|
||||||
"\n query Objects {\n objects(paging: { first: 100 }) {\n edges {\n node {\n id\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n fields(paging: { first: 100 }) {\n edges {\n node {\n id\n type\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n": types.ObjectsDocument,
|
"\n query Objects {\n objects(paging: { first: 100 }) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n fields(paging: { first: 100 }) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n": types.ObjectsDocument,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,11 +39,11 @@ export function graphql(source: "\n mutation CreateOneObject($input: CreateOneO
|
|||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
export function graphql(source: "\n mutation CreateOneField($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation CreateOneField($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
export function graphql(source: "\n mutation CreateOneField($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"): (typeof documents)["\n mutation CreateOneField($input: CreateOneFieldInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n"];
|
||||||
/**
|
/**
|
||||||
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||||
*/
|
*/
|
||||||
export function graphql(source: "\n query Objects {\n objects(paging: { first: 100 }) {\n edges {\n node {\n id\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n fields(paging: { first: 100 }) {\n edges {\n node {\n id\n type\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query Objects {\n objects(paging: { first: 100 }) {\n edges {\n node {\n id\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n fields(paging: { first: 100 }) {\n edges {\n node {\n id\n type\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"];
|
export function graphql(source: "\n query Objects {\n objects(paging: { first: 100 }) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n fields(paging: { first: 100 }) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query Objects {\n objects(paging: { first: 100 }) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n fields(paging: { first: 100 }) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"];
|
||||||
|
|
||||||
export function graphql(source: string) {
|
export function graphql(source: string) {
|
||||||
return (documents as any)[source] ?? {};
|
return (documents as any)[source] ?? {};
|
||||||
|
|||||||
@ -171,12 +171,9 @@ export type Company = {
|
|||||||
export type CreateFieldInput = {
|
export type CreateFieldInput = {
|
||||||
description?: InputMaybe<Scalars['String']['input']>;
|
description?: InputMaybe<Scalars['String']['input']>;
|
||||||
icon?: InputMaybe<Scalars['String']['input']>;
|
icon?: InputMaybe<Scalars['String']['input']>;
|
||||||
labelPlural?: InputMaybe<Scalars['String']['input']>;
|
label: Scalars['String']['input'];
|
||||||
labelSingular: Scalars['String']['input'];
|
name: Scalars['String']['input'];
|
||||||
namePlural?: InputMaybe<Scalars['String']['input']>;
|
|
||||||
nameSingular: Scalars['String']['input'];
|
|
||||||
objectId: Scalars['String']['input'];
|
objectId: Scalars['String']['input'];
|
||||||
placeholder?: InputMaybe<Scalars['String']['input']>;
|
|
||||||
type: Scalars['String']['input'];
|
type: Scalars['String']['input'];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -381,6 +378,16 @@ export type CursorPaging = {
|
|||||||
last?: InputMaybe<Scalars['Int']['input']>;
|
last?: InputMaybe<Scalars['Int']['input']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type DeleteOneFieldInput = {
|
||||||
|
/** The id of the record to delete. */
|
||||||
|
id: Scalars['ID']['input'];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DeleteOneObjectInput = {
|
||||||
|
/** The id of the record to delete. */
|
||||||
|
id: Scalars['ID']['input'];
|
||||||
|
};
|
||||||
|
|
||||||
export type Favorite = {
|
export type Favorite = {
|
||||||
__typename?: 'Favorite';
|
__typename?: 'Favorite';
|
||||||
company?: Maybe<Company>;
|
company?: Maybe<Company>;
|
||||||
@ -403,10 +410,29 @@ export type FieldConnection = {
|
|||||||
totalCount: Scalars['Int']['output'];
|
totalCount: Scalars['Int']['output'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type FieldDeleteResponse = {
|
||||||
|
__typename?: 'FieldDeleteResponse';
|
||||||
|
createdAt?: Maybe<Scalars['DateTime']['output']>;
|
||||||
|
description?: Maybe<Scalars['String']['output']>;
|
||||||
|
icon?: Maybe<Scalars['String']['output']>;
|
||||||
|
id?: Maybe<Scalars['ID']['output']>;
|
||||||
|
isActive?: Maybe<Scalars['Boolean']['output']>;
|
||||||
|
isCustom?: Maybe<Scalars['Boolean']['output']>;
|
||||||
|
isNullable?: Maybe<Scalars['Boolean']['output']>;
|
||||||
|
label?: Maybe<Scalars['String']['output']>;
|
||||||
|
name?: Maybe<Scalars['String']['output']>;
|
||||||
|
/** @deprecated Use label name instead */
|
||||||
|
placeholder?: Maybe<Scalars['String']['output']>;
|
||||||
|
type?: Maybe<Scalars['String']['output']>;
|
||||||
|
updatedAt?: Maybe<Scalars['DateTime']['output']>;
|
||||||
|
};
|
||||||
|
|
||||||
export type Mutation = {
|
export type Mutation = {
|
||||||
__typename?: 'Mutation';
|
__typename?: 'Mutation';
|
||||||
createOneField: Field;
|
createOneField: Field;
|
||||||
createOneObject: Object;
|
createOneObject: Object;
|
||||||
|
deleteOneField: FieldDeleteResponse;
|
||||||
|
deleteOneObject: ObjectDeleteResponse;
|
||||||
updateOneField: Field;
|
updateOneField: Field;
|
||||||
updateOneObject: Object;
|
updateOneObject: Object;
|
||||||
};
|
};
|
||||||
@ -422,6 +448,16 @@ export type MutationCreateOneObjectArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type MutationDeleteOneFieldArgs = {
|
||||||
|
input: DeleteOneFieldInput;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type MutationDeleteOneObjectArgs = {
|
||||||
|
input: DeleteOneObjectInput;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export type MutationUpdateOneFieldArgs = {
|
export type MutationUpdateOneFieldArgs = {
|
||||||
input: UpdateOneFieldInput;
|
input: UpdateOneFieldInput;
|
||||||
};
|
};
|
||||||
@ -441,6 +477,22 @@ export type ObjectConnection = {
|
|||||||
totalCount: Scalars['Int']['output'];
|
totalCount: Scalars['Int']['output'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ObjectDeleteResponse = {
|
||||||
|
__typename?: 'ObjectDeleteResponse';
|
||||||
|
createdAt?: Maybe<Scalars['DateTime']['output']>;
|
||||||
|
dataSourceId?: Maybe<Scalars['String']['output']>;
|
||||||
|
description?: Maybe<Scalars['String']['output']>;
|
||||||
|
icon?: Maybe<Scalars['String']['output']>;
|
||||||
|
id?: Maybe<Scalars['ID']['output']>;
|
||||||
|
isActive?: Maybe<Scalars['Boolean']['output']>;
|
||||||
|
isCustom?: Maybe<Scalars['Boolean']['output']>;
|
||||||
|
labelPlural?: Maybe<Scalars['String']['output']>;
|
||||||
|
labelSingular?: Maybe<Scalars['String']['output']>;
|
||||||
|
namePlural?: Maybe<Scalars['String']['output']>;
|
||||||
|
nameSingular?: Maybe<Scalars['String']['output']>;
|
||||||
|
updatedAt?: Maybe<Scalars['DateTime']['output']>;
|
||||||
|
};
|
||||||
|
|
||||||
export type ObjectFieldsConnection = {
|
export type ObjectFieldsConnection = {
|
||||||
__typename?: 'ObjectFieldsConnection';
|
__typename?: 'ObjectFieldsConnection';
|
||||||
/** Array of edges. */
|
/** Array of edges. */
|
||||||
@ -582,11 +634,8 @@ export type UpdateFieldInput = {
|
|||||||
description?: InputMaybe<Scalars['String']['input']>;
|
description?: InputMaybe<Scalars['String']['input']>;
|
||||||
icon?: InputMaybe<Scalars['String']['input']>;
|
icon?: InputMaybe<Scalars['String']['input']>;
|
||||||
isActive?: InputMaybe<Scalars['Boolean']['input']>;
|
isActive?: InputMaybe<Scalars['Boolean']['input']>;
|
||||||
labelPlural?: InputMaybe<Scalars['String']['input']>;
|
label: Scalars['String']['input'];
|
||||||
labelSingular?: InputMaybe<Scalars['String']['input']>;
|
name: Scalars['String']['input'];
|
||||||
namePlural?: InputMaybe<Scalars['String']['input']>;
|
|
||||||
nameSingular?: InputMaybe<Scalars['String']['input']>;
|
|
||||||
placeholder?: InputMaybe<Scalars['String']['input']>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateObjectInput = {
|
export type UpdateObjectInput = {
|
||||||
@ -767,10 +816,9 @@ export type Field = {
|
|||||||
isActive: Scalars['Boolean']['output'];
|
isActive: Scalars['Boolean']['output'];
|
||||||
isCustom: Scalars['Boolean']['output'];
|
isCustom: Scalars['Boolean']['output'];
|
||||||
isNullable: Scalars['Boolean']['output'];
|
isNullable: Scalars['Boolean']['output'];
|
||||||
labelPlural: Scalars['String']['output'];
|
label: Scalars['String']['output'];
|
||||||
labelSingular: Scalars['String']['output'];
|
name: Scalars['String']['output'];
|
||||||
namePlural: Scalars['String']['output'];
|
/** @deprecated Use label name instead */
|
||||||
nameSingular: Scalars['String']['output'];
|
|
||||||
placeholder?: Maybe<Scalars['String']['output']>;
|
placeholder?: Maybe<Scalars['String']['output']>;
|
||||||
type: Scalars['String']['output'];
|
type: Scalars['String']['output'];
|
||||||
updatedAt: Scalars['DateTime']['output'];
|
updatedAt: Scalars['DateTime']['output'];
|
||||||
@ -826,14 +874,14 @@ export type CreateOneFieldMutationVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type CreateOneFieldMutation = { __typename?: 'Mutation', createOneField: { __typename?: 'field', id: string, type: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, placeholder?: string | null, isCustom: boolean, isActive: boolean, isNullable: boolean, createdAt: any, updatedAt: any } };
|
export type CreateOneFieldMutation = { __typename?: 'Mutation', createOneField: { __typename?: 'field', id: string, type: string, name: string, label: string, description?: string | null, icon?: string | null, placeholder?: string | null, isCustom: boolean, isActive: boolean, isNullable: boolean, createdAt: any, updatedAt: any } };
|
||||||
|
|
||||||
export type ObjectsQueryVariables = Exact<{ [key: string]: never; }>;
|
export type ObjectsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
export type ObjectsQuery = { __typename?: 'Query', objects: { __typename?: 'ObjectConnection', totalCount: number, edges: Array<{ __typename?: 'objectEdge', node: { __typename?: 'object', id: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isActive: boolean, createdAt: any, updatedAt: any, fields: { __typename?: 'ObjectFieldsConnection', totalCount: number, edges: Array<{ __typename?: 'fieldEdge', node: { __typename?: 'field', id: string, type: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, placeholder?: string | null, isCustom: boolean, isActive: boolean, isNullable: boolean, createdAt: any, updatedAt: any } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } };
|
export type ObjectsQuery = { __typename?: 'Query', objects: { __typename?: 'ObjectConnection', totalCount: number, edges: Array<{ __typename?: 'objectEdge', node: { __typename?: 'object', id: string, dataSourceId: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isActive: boolean, createdAt: any, updatedAt: any, fields: { __typename?: 'ObjectFieldsConnection', totalCount: number, edges: Array<{ __typename?: 'fieldEdge', node: { __typename?: 'field', id: string, type: string, name: string, label: string, description?: string | null, icon?: string | null, placeholder?: string | null, isCustom: boolean, isActive: boolean, isNullable: boolean, createdAt: any, updatedAt: any } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } };
|
||||||
|
|
||||||
|
|
||||||
export const CreateOneObjectDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneObject"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneObjectInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneObject"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<CreateOneObjectMutation, CreateOneObjectMutationVariables>;
|
export const CreateOneObjectDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneObject"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneObjectInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneObject"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<CreateOneObjectMutation, CreateOneObjectMutationVariables>;
|
||||||
export const CreateOneFieldDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneField"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneFieldInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneField"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"placeholder"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<CreateOneFieldMutation, CreateOneFieldMutationVariables>;
|
export const CreateOneFieldDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneField"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneFieldInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneField"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"placeholder"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode<CreateOneFieldMutation, CreateOneFieldMutationVariables>;
|
||||||
export const ObjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"paging"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"100"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"paging"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"100"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"placeholder"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"hasPreviousPage"}},{"kind":"Field","name":{"kind":"Name","value":"startCursor"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"hasPreviousPage"}},{"kind":"Field","name":{"kind":"Name","value":"startCursor"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode<ObjectsQuery, ObjectsQueryVariables>;
|
export const ObjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"objects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"paging"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"100"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"dataSourceId"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"paging"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"100"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"placeholder"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"hasPreviousPage"}},{"kind":"Field","name":{"kind":"Name","value":"startCursor"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"hasPreviousPage"}},{"kind":"Field","name":{"kind":"Name","value":"startCursor"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode<ObjectsQuery, ObjectsQueryVariables>;
|
||||||
@ -1298,6 +1298,23 @@ export type FieldConnection = {
|
|||||||
totalCount: Scalars['Int'];
|
totalCount: Scalars['Int'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type FieldDeleteResponse = {
|
||||||
|
__typename?: 'FieldDeleteResponse';
|
||||||
|
createdAt?: Maybe<Scalars['DateTime']>;
|
||||||
|
description?: Maybe<Scalars['String']>;
|
||||||
|
icon?: Maybe<Scalars['String']>;
|
||||||
|
id?: Maybe<Scalars['ID']>;
|
||||||
|
isActive?: Maybe<Scalars['Boolean']>;
|
||||||
|
isCustom?: Maybe<Scalars['Boolean']>;
|
||||||
|
isNullable?: Maybe<Scalars['Boolean']>;
|
||||||
|
label?: Maybe<Scalars['String']>;
|
||||||
|
name?: Maybe<Scalars['String']>;
|
||||||
|
/** @deprecated Use label name instead */
|
||||||
|
placeholder?: Maybe<Scalars['String']>;
|
||||||
|
type?: Maybe<Scalars['String']>;
|
||||||
|
updatedAt?: Maybe<Scalars['DateTime']>;
|
||||||
|
};
|
||||||
|
|
||||||
export enum FileFolder {
|
export enum FileFolder {
|
||||||
Attachment = 'Attachment',
|
Attachment = 'Attachment',
|
||||||
PersonPicture = 'PersonPicture',
|
PersonPicture = 'PersonPicture',
|
||||||
@ -1848,6 +1865,22 @@ export type ObjectConnection = {
|
|||||||
totalCount: Scalars['Int'];
|
totalCount: Scalars['Int'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ObjectDeleteResponse = {
|
||||||
|
__typename?: 'ObjectDeleteResponse';
|
||||||
|
createdAt?: Maybe<Scalars['DateTime']>;
|
||||||
|
dataSourceId?: Maybe<Scalars['String']>;
|
||||||
|
description?: Maybe<Scalars['String']>;
|
||||||
|
icon?: Maybe<Scalars['String']>;
|
||||||
|
id?: Maybe<Scalars['ID']>;
|
||||||
|
isActive?: Maybe<Scalars['Boolean']>;
|
||||||
|
isCustom?: Maybe<Scalars['Boolean']>;
|
||||||
|
labelPlural?: Maybe<Scalars['String']>;
|
||||||
|
labelSingular?: Maybe<Scalars['String']>;
|
||||||
|
namePlural?: Maybe<Scalars['String']>;
|
||||||
|
nameSingular?: Maybe<Scalars['String']>;
|
||||||
|
updatedAt?: Maybe<Scalars['DateTime']>;
|
||||||
|
};
|
||||||
|
|
||||||
export type ObjectFieldsConnection = {
|
export type ObjectFieldsConnection = {
|
||||||
__typename?: 'ObjectFieldsConnection';
|
__typename?: 'ObjectFieldsConnection';
|
||||||
/** Array of edges. */
|
/** Array of edges. */
|
||||||
@ -3540,10 +3573,9 @@ export type Field = {
|
|||||||
isActive: Scalars['Boolean'];
|
isActive: Scalars['Boolean'];
|
||||||
isCustom: Scalars['Boolean'];
|
isCustom: Scalars['Boolean'];
|
||||||
isNullable: Scalars['Boolean'];
|
isNullable: Scalars['Boolean'];
|
||||||
labelPlural: Scalars['String'];
|
label: Scalars['String'];
|
||||||
labelSingular: Scalars['String'];
|
name: Scalars['String'];
|
||||||
namePlural: Scalars['String'];
|
/** @deprecated Use label name instead */
|
||||||
nameSingular: Scalars['String'];
|
|
||||||
placeholder?: Maybe<Scalars['String']>;
|
placeholder?: Maybe<Scalars['String']>;
|
||||||
type: Scalars['String'];
|
type: Scalars['String'];
|
||||||
updatedAt: Scalars['DateTime'];
|
updatedAt: Scalars['DateTime'];
|
||||||
|
|||||||
@ -13,10 +13,8 @@ export const CREATE_ONE_FIELD = gql`
|
|||||||
createOneField(input: $input) {
|
createOneField(input: $input) {
|
||||||
id
|
id
|
||||||
type
|
type
|
||||||
nameSingular
|
name
|
||||||
namePlural
|
label
|
||||||
labelSingular
|
|
||||||
labelPlural
|
|
||||||
description
|
description
|
||||||
icon
|
icon
|
||||||
placeholder
|
placeholder
|
||||||
|
|||||||
@ -22,10 +22,8 @@ export const GET_ALL_OBJECTS = gql`
|
|||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
type
|
type
|
||||||
nameSingular
|
name
|
||||||
namePlural
|
label
|
||||||
labelSingular
|
|
||||||
labelPlural
|
|
||||||
description
|
description
|
||||||
icon
|
icon
|
||||||
placeholder
|
placeholder
|
||||||
|
|||||||
@ -45,13 +45,10 @@ export const useSeedCustomObjectsTemp = () => {
|
|||||||
input: {
|
input: {
|
||||||
field: {
|
field: {
|
||||||
objectId: supplierObjectId,
|
objectId: supplierObjectId,
|
||||||
labelSingular: 'Name',
|
label: 'Name',
|
||||||
nameSingular: 'name',
|
name: 'name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
description: 'Name',
|
description: 'Name',
|
||||||
labelPlural: 'Names',
|
|
||||||
namePlural: 'names',
|
|
||||||
placeholder: 'Name',
|
|
||||||
icon: 'IconBuilding',
|
icon: 'IconBuilding',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -67,13 +64,10 @@ export const useSeedCustomObjectsTemp = () => {
|
|||||||
input: {
|
input: {
|
||||||
field: {
|
field: {
|
||||||
objectId: supplierObjectId,
|
objectId: supplierObjectId,
|
||||||
labelSingular: 'City',
|
label: 'City',
|
||||||
nameSingular: 'city',
|
name: 'city',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
description: 'City',
|
description: 'City',
|
||||||
labelPlural: 'Cities',
|
|
||||||
namePlural: 'cities',
|
|
||||||
placeholder: 'City',
|
|
||||||
icon: 'IconMap',
|
icon: 'IconMap',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,9 +15,7 @@ export const generateFindManyCustomObjectsQuery = ({
|
|||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
${metadataObject.fields
|
${metadataObject.fields.map((field) => field.name).join('\n')}
|
||||||
.map((field) => field.nameSingular)
|
|
||||||
.join('\n')}
|
|
||||||
}
|
}
|
||||||
cursor
|
cursor
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,22 +13,12 @@ export class CreateFieldInput {
|
|||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@Field()
|
@Field()
|
||||||
nameSingular: string;
|
name: string;
|
||||||
|
|
||||||
@IsString()
|
|
||||||
@IsOptional()
|
|
||||||
@Field({ nullable: true })
|
|
||||||
namePlural?: string;
|
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@Field()
|
@Field()
|
||||||
labelSingular: string;
|
label: string;
|
||||||
|
|
||||||
@IsString()
|
|
||||||
@IsOptional()
|
|
||||||
@Field({ nullable: true })
|
|
||||||
labelPlural?: string;
|
|
||||||
|
|
||||||
// Todo: use a type enum and share with typeorm entity
|
// Todo: use a type enum and share with typeorm entity
|
||||||
@IsEnum([
|
@IsEnum([
|
||||||
|
|||||||
@ -1,28 +1,18 @@
|
|||||||
import { Field, InputType } from '@nestjs/graphql';
|
import { Field, InputType } from '@nestjs/graphql';
|
||||||
|
|
||||||
import { IsBoolean, IsOptional, IsString } from 'class-validator';
|
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class UpdateFieldInput {
|
export class UpdateFieldInput {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsNotEmpty()
|
||||||
@Field({ nullable: true })
|
@Field()
|
||||||
nameSingular?: string;
|
name: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsNotEmpty()
|
||||||
@Field({ nullable: true })
|
@Field()
|
||||||
namePlural?: string;
|
label: string;
|
||||||
|
|
||||||
@IsString()
|
|
||||||
@IsOptional()
|
|
||||||
@Field({ nullable: true })
|
|
||||||
labelSingular?: string;
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
@IsOptional()
|
|
||||||
@Field({ nullable: true })
|
|
||||||
labelPlural?: string;
|
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export const fieldMetadataAutoResolverOpts: AutoResolverOpts<
|
|||||||
update: {
|
update: {
|
||||||
many: { disabled: true },
|
many: { disabled: true },
|
||||||
},
|
},
|
||||||
delete: { disabled: true },
|
delete: { many: { disabled: true } },
|
||||||
guards: [JwtAuthGuard],
|
guards: [JwtAuthGuard],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -51,20 +51,12 @@ export class FieldMetadata {
|
|||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
@Field()
|
@Field()
|
||||||
@Column({ nullable: false, name: 'name_singular' })
|
@Column({ nullable: false })
|
||||||
nameSingular: string;
|
name: string;
|
||||||
|
|
||||||
@Field()
|
@Field()
|
||||||
@Column({ nullable: true, name: 'name_plural' })
|
@Column({ nullable: false })
|
||||||
namePlural: string;
|
label: string;
|
||||||
|
|
||||||
@Field()
|
|
||||||
@Column({ nullable: false, name: 'label_singular' })
|
|
||||||
labelSingular: string;
|
|
||||||
|
|
||||||
@Field()
|
|
||||||
@Column({ nullable: true, name: 'label_plural' })
|
|
||||||
labelPlural: string;
|
|
||||||
|
|
||||||
@Column({ nullable: false, name: 'target_column_map', type: 'jsonb' })
|
@Column({ nullable: false, name: 'target_column_map', type: 'jsonb' })
|
||||||
targetColumnMap: FieldMetadataTargetColumnMap;
|
targetColumnMap: FieldMetadataTargetColumnMap;
|
||||||
|
|||||||
@ -44,8 +44,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadata> {
|
|||||||
|
|
||||||
const fieldAlreadyExists = await this.fieldMetadataRepository.findOne({
|
const fieldAlreadyExists = await this.fieldMetadataRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
nameSingular: record.nameSingular,
|
name: record.name,
|
||||||
namePlural: record.namePlural,
|
|
||||||
objectId: record.objectId,
|
objectId: record.objectId,
|
||||||
workspaceId: record.workspaceId,
|
workspaceId: record.workspaceId,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { AddTargetColumnMap1696409050890 } from './migrations/1696409050890-add-
|
|||||||
import { MetadataNameLabelRefactoring1697126636202 } from './migrations/1697126636202-MetadataNameLabelRefactoring';
|
import { MetadataNameLabelRefactoring1697126636202 } from './migrations/1697126636202-MetadataNameLabelRefactoring';
|
||||||
import { RemoveFieldMetadataPlaceholder1697471445015 } from './migrations/1697471445015-removeFieldMetadataPlaceholder';
|
import { RemoveFieldMetadataPlaceholder1697471445015 } from './migrations/1697471445015-removeFieldMetadataPlaceholder';
|
||||||
import { AddSoftDelete1697474804403 } from './migrations/1697474804403-addSoftDelete';
|
import { AddSoftDelete1697474804403 } from './migrations/1697474804403-addSoftDelete';
|
||||||
|
import { RemoveSingularPluralFromFieldLabelAndName1697534910933 } from './migrations/1697534910933-removeSingularPluralFromFieldLabelAndName';
|
||||||
|
|
||||||
config();
|
config();
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ export const typeORMMetadataModuleOptions: TypeOrmModuleOptions = {
|
|||||||
MetadataNameLabelRefactoring1697126636202,
|
MetadataNameLabelRefactoring1697126636202,
|
||||||
RemoveFieldMetadataPlaceholder1697471445015,
|
RemoveFieldMetadataPlaceholder1697471445015,
|
||||||
AddSoftDelete1697474804403,
|
AddSoftDelete1697474804403,
|
||||||
|
RemoveSingularPluralFromFieldLabelAndName1697534910933,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -116,17 +116,17 @@ export class MigrationRunnerService {
|
|||||||
default: 'public.uuid_generate_v4()',
|
default: 'public.uuid_generate_v4()',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'created_at',
|
name: 'createdAt',
|
||||||
type: 'timestamp',
|
type: 'timestamp',
|
||||||
default: 'now()',
|
default: 'now()',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'updated_at',
|
name: 'updatedAt',
|
||||||
type: 'timestamp',
|
type: 'timestamp',
|
||||||
default: 'now()',
|
default: 'now()',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'deleted_at',
|
name: 'deletedAt',
|
||||||
type: 'timestamp',
|
type: 'timestamp',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -0,0 +1,49 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class RemoveSingularPluralFromFieldLabelAndName1697534910933
|
||||||
|
implements MigrationInterface
|
||||||
|
{
|
||||||
|
name = 'RemoveSingularPluralFromFieldLabelAndName1697534910933';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" DROP COLUMN "name_singular"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" DROP COLUMN "name_plural"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" DROP COLUMN "label_singular"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" DROP COLUMN "label_plural"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" ADD "name" character varying NOT NULL`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" ADD "label" character varying NOT NULL`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" DROP COLUMN "label"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" DROP COLUMN "name"`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" ADD "label_plural" character varying`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" ADD "label_singular" character varying NOT NULL`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" ADD "name_plural" character varying`,
|
||||||
|
);
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TABLE "metadata"."field_metadata" ADD "name_singular" character varying NOT NULL`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -30,7 +30,7 @@ export class BeforeCreateOneObject<T extends ObjectMetadata>
|
|||||||
);
|
);
|
||||||
|
|
||||||
instance.input.dataSourceId = lastDataSourceMetadata.id;
|
instance.input.dataSourceId = lastDataSourceMetadata.id;
|
||||||
instance.input.targetTableName = instance.input.nameSingular;
|
instance.input.targetTableName = instance.input.namePlural;
|
||||||
instance.input.workspaceId = workspaceId;
|
instance.input.workspaceId = workspaceId;
|
||||||
instance.input.isActive = false;
|
instance.input.isActive = false;
|
||||||
instance.input.isCustom = true;
|
instance.input.isCustom = true;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export const objectMetadataAutoResolverOpts: AutoResolverOpts<
|
|||||||
update: {
|
update: {
|
||||||
many: { disabled: true },
|
many: { disabled: true },
|
||||||
},
|
},
|
||||||
|
delete: { many: { disabled: true } },
|
||||||
guards: [JwtAuthGuard],
|
guards: [JwtAuthGuard],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -36,19 +36,19 @@ describe('PGGraphQLQueryBuilder', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const fields = [
|
const fields = [
|
||||||
{
|
{
|
||||||
nameSingular: 'name',
|
name: 'name',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'column_name',
|
value: 'column_name',
|
||||||
} as FieldMetadataTargetColumnMap,
|
} as FieldMetadataTargetColumnMap,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'age',
|
name: 'age',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'column_age',
|
value: 'column_age',
|
||||||
} as FieldMetadataTargetColumnMap,
|
} as FieldMetadataTargetColumnMap,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'complexField',
|
name: 'complexField',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
subField1: 'column_subField1',
|
subField1: 'column_subField1',
|
||||||
subField2: 'column_subField2',
|
subField2: 'column_subField2',
|
||||||
|
|||||||
@ -10,21 +10,21 @@ describe('convertArguments', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fields = [
|
fields = [
|
||||||
{
|
{
|
||||||
nameSingular: 'firstName',
|
name: 'firstName',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'column_1randomFirstNameKey',
|
value: 'column_1randomFirstNameKey',
|
||||||
} as FieldMetadataTargetColumnMap,
|
} as FieldMetadataTargetColumnMap,
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'age',
|
name: 'age',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'column_randomAgeKey',
|
value: 'column_randomAgeKey',
|
||||||
} as FieldMetadataTargetColumnMap,
|
} as FieldMetadataTargetColumnMap,
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'website',
|
name: 'website',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
link: 'column_randomLinkKey',
|
link: 'column_randomLinkKey',
|
||||||
text: 'column_randomTex7Key',
|
text: 'column_randomTex7Key',
|
||||||
|
|||||||
@ -12,13 +12,13 @@ describe('convertFieldsToGraphQL', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fields = [
|
fields = [
|
||||||
{
|
{
|
||||||
nameSingular: 'simpleField',
|
name: 'simpleField',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'column_RANDOMSTRING1',
|
value: 'column_RANDOMSTRING1',
|
||||||
} as FieldMetadataTargetColumnMap,
|
} as FieldMetadataTargetColumnMap,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'complexField',
|
name: 'complexField',
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
link: 'column_RANDOMSTRING2',
|
link: 'column_RANDOMSTRING2',
|
||||||
text: 'column_RANDOMSTRING3',
|
text: 'column_RANDOMSTRING3',
|
||||||
@ -74,7 +74,7 @@ describe('convertFieldsToGraphQL', () => {
|
|||||||
|
|
||||||
test('should handle empty targetColumnMap gracefully', () => {
|
test('should handle empty targetColumnMap gracefully', () => {
|
||||||
const emptyField = {
|
const emptyField = {
|
||||||
nameSingular: 'emptyField',
|
name: 'emptyField',
|
||||||
targetColumnMap: {},
|
targetColumnMap: {},
|
||||||
} as FieldMetadata;
|
} as FieldMetadata;
|
||||||
|
|
||||||
|
|||||||
@ -11,15 +11,13 @@ describe('getFieldAliases', () => {
|
|||||||
// Setup sample field metadata
|
// Setup sample field metadata
|
||||||
fields = [
|
fields = [
|
||||||
{
|
{
|
||||||
nameSingular: 'singleValueField',
|
name: 'singleValueField',
|
||||||
namePlural: 'singleValueFields',
|
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
value: 'column_singleValue',
|
value: 'column_singleValue',
|
||||||
} as FieldMetadataTargetColumnMap,
|
} as FieldMetadataTargetColumnMap,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'multipleValuesField',
|
name: 'multipleValuesField',
|
||||||
namePlural: 'multipleValuesFields',
|
|
||||||
targetColumnMap: {
|
targetColumnMap: {
|
||||||
link: 'column_value1',
|
link: 'column_value1',
|
||||||
text: 'column_value2',
|
text: 'column_value2',
|
||||||
@ -47,8 +45,7 @@ describe('getFieldAliases', () => {
|
|||||||
const fieldsWithEmptyMap = [
|
const fieldsWithEmptyMap = [
|
||||||
...fields,
|
...fields,
|
||||||
{
|
{
|
||||||
nameSingular: 'emptyField',
|
name: 'emptyField',
|
||||||
namePlural: 'emptyFields',
|
|
||||||
targetColumnMap: {} as FieldMetadataTargetColumnMap,
|
targetColumnMap: {} as FieldMetadataTargetColumnMap,
|
||||||
},
|
},
|
||||||
] as FieldMetadata[];
|
] as FieldMetadata[];
|
||||||
|
|||||||
@ -4,8 +4,7 @@ import { FieldMetadata } from 'src/metadata/field-metadata/field-metadata.entity
|
|||||||
|
|
||||||
export const convertArguments = (args: any, fields: FieldMetadata[]): any => {
|
export const convertArguments = (args: any, fields: FieldMetadata[]): any => {
|
||||||
const fieldsMap = new Map(
|
const fieldsMap = new Map(
|
||||||
// TODO: Handle plural for fields when we add relations
|
fields.map((metadata) => [metadata.name, metadata]),
|
||||||
fields.map((metadata) => [metadata.nameSingular, metadata]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Array.isArray(args)) {
|
if (Array.isArray(args)) {
|
||||||
|
|||||||
@ -8,8 +8,7 @@ export const convertFieldsToGraphQL = (
|
|||||||
acc = '',
|
acc = '',
|
||||||
) => {
|
) => {
|
||||||
const fieldsMap = new Map(
|
const fieldsMap = new Map(
|
||||||
// TODO: Handle plural for fields when we add relations
|
fields.map((metadata) => [metadata.name, metadata]),
|
||||||
fields.map((metadata) => [metadata.nameSingular, metadata]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(select)) {
|
for (const [key, value] of Object.entries(select)) {
|
||||||
@ -29,9 +28,7 @@ export const convertFieldsToGraphQL = (
|
|||||||
// Otherwise it means it's a special type with multiple values, so we need fetch all fields
|
// Otherwise it means it's a special type with multiple values, so we need fetch all fields
|
||||||
fieldAlias = `
|
fieldAlias = `
|
||||||
${entries
|
${entries
|
||||||
.map(
|
.map(([key, value]) => `___${metadata.name}_${key}: ${value}`)
|
||||||
([key, value]) => `___${metadata.nameSingular}_${key}: ${value}`,
|
|
||||||
)
|
|
||||||
.join('\n')}
|
.join('\n')}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,7 @@ export const getFieldAliases = (fields: FieldMetadata[]) => {
|
|||||||
if (values.length === 1) {
|
if (values.length === 1) {
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
// TODO: Handle plural for fields when we add relations
|
[column.name]: values[0],
|
||||||
[column.nameSingular]: values[0],
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -30,12 +30,12 @@ describe('generateCreateInputType', () => {
|
|||||||
test('should generate fields with correct types and descriptions', () => {
|
test('should generate fields with correct types and descriptions', () => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
nameSingular: 'firstName',
|
name: 'firstName',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'age',
|
name: 'age',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -46,12 +46,12 @@ describe('generateObjectType', () => {
|
|||||||
test('should generate fields based on provided columns', () => {
|
test('should generate fields based on provided columns', () => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
nameSingular: 'firstName',
|
name: 'firstName',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'age',
|
name: 'age',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -29,12 +29,12 @@ describe('generateUpdateInputType', () => {
|
|||||||
test('should generate fields with correct types and descriptions', () => {
|
test('should generate fields with correct types and descriptions', () => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
nameSingular: 'firstName',
|
name: 'firstName',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
nameSingular: 'age',
|
name: 'age',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -40,7 +40,7 @@ describe('mapColumnTypeToGraphQLType', () => {
|
|||||||
test('should create a GraphQLEnumType for enum fields', () => {
|
test('should create a GraphQLEnumType for enum fields', () => {
|
||||||
const column = new FieldMetadata();
|
const column = new FieldMetadata();
|
||||||
column.type = 'enum';
|
column.type = 'enum';
|
||||||
column.nameSingular = 'Status';
|
column.name = 'Status';
|
||||||
column.enums = ['ACTIVE', 'INACTIVE'];
|
column.enums = ['ACTIVE', 'INACTIVE'];
|
||||||
const result = mapColumnTypeToGraphQLType(column);
|
const result = mapColumnTypeToGraphQLType(column);
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export const generateCreateInputType = (
|
|||||||
columns.forEach((column) => {
|
columns.forEach((column) => {
|
||||||
const graphqlType = mapColumnTypeToGraphQLType(column, true);
|
const graphqlType = mapColumnTypeToGraphQLType(column, true);
|
||||||
|
|
||||||
fields[column.nameSingular] = {
|
fields[column.name] = {
|
||||||
type: !column.isNullable ? new GraphQLNonNull(graphqlType) : graphqlType,
|
type: !column.isNullable ? new GraphQLNonNull(graphqlType) : graphqlType,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -33,7 +33,7 @@ export const generateObjectType = <TSource = any, TContext = any>(
|
|||||||
columns.forEach((column) => {
|
columns.forEach((column) => {
|
||||||
const graphqlType = mapColumnTypeToGraphQLType(column);
|
const graphqlType = mapColumnTypeToGraphQLType(column);
|
||||||
|
|
||||||
fields[column.nameSingular] = {
|
fields[column.name] = {
|
||||||
type: !column.isNullable ? new GraphQLNonNull(graphqlType) : graphqlType,
|
type: !column.isNullable ? new GraphQLNonNull(graphqlType) : graphqlType,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export const generateUpdateInputType = (
|
|||||||
columns.forEach((column) => {
|
columns.forEach((column) => {
|
||||||
const graphqlType = mapColumnTypeToGraphQLType(column, true);
|
const graphqlType = mapColumnTypeToGraphQLType(column, true);
|
||||||
// No GraphQLNonNull wrapping here, so all fields are optional
|
// No GraphQLNonNull wrapping here, so all fields are optional
|
||||||
fields[column.nameSingular] = {
|
fields[column.name] = {
|
||||||
type: graphqlType,
|
type: graphqlType,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -65,7 +65,7 @@ export const mapColumnTypeToGraphQLType = (
|
|||||||
return GraphQLInt;
|
return GraphQLInt;
|
||||||
case 'enum': {
|
case 'enum': {
|
||||||
if (column.enums && column.enums.length > 0) {
|
if (column.enums && column.enums.length > 0) {
|
||||||
const enumName = `${pascalCase(column.nameSingular)}Enum`;
|
const enumName = `${pascalCase(column.name)}Enum`;
|
||||||
|
|
||||||
return new GraphQLEnumType({
|
return new GraphQLEnumType({
|
||||||
name: enumName,
|
name: enumName,
|
||||||
|
|||||||
Reference in New Issue
Block a user