Files
twenty/packages/twenty-front/src/modules/object-metadata/graphql/mutations.ts
Weiko 3c7805c6d0 Add field isLabelSyncedWithName (#8829)
## Context
The recent addition of object renaming introduced issues with enum
names. Enum names should follow the pattern
`${schemaName}.${tableName}_${columnName}_enum`. To address this, and to
allow users to customize the API name (which is included in the enum
name, columnName), this PR implements behavior similar to object
renaming by introducing a `isLabelSyncedWithName` boolean.

<img width="624" alt="Screenshot 2024-12-02 at 11 58 49"
src="https://github.com/user-attachments/assets/690fb71c-83f0-4922-80c0-946c92dacc30">
<img width="596" alt="Screenshot 2024-12-02 at 11 58 39"
src="https://github.com/user-attachments/assets/af9a0037-7cf5-40c3-9ed5-d51b340c8087">
2024-12-03 13:22:12 +01:00

154 lines
3.1 KiB
TypeScript

import { gql } from '@apollo/client';
export const CREATE_ONE_OBJECT_METADATA_ITEM = gql`
mutation CreateOneObjectMetadataItem($input: CreateOneObjectInput!) {
createOneObject(input: $input) {
id
dataSourceId
nameSingular
namePlural
labelSingular
labelPlural
description
icon
isCustom
isActive
createdAt
updatedAt
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
}
}
`;
export const CREATE_ONE_FIELD_METADATA_ITEM = gql`
mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {
createOneField(input: $input) {
id
type
name
label
description
icon
isCustom
isActive
isNullable
createdAt
updatedAt
settings
defaultValue
options
}
}
`;
export const CREATE_ONE_RELATION_METADATA_ITEM = gql`
mutation CreateOneRelationMetadata($input: CreateOneRelationInput!) {
createOneRelation(input: $input) {
id
relationType
fromObjectMetadataId
toObjectMetadataId
fromFieldMetadataId
toFieldMetadataId
createdAt
updatedAt
}
}
`;
export const UPDATE_ONE_FIELD_METADATA_ITEM = gql`
mutation UpdateOneFieldMetadataItem(
$idToUpdate: UUID!
$updatePayload: UpdateFieldInput!
) {
updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {
id
type
name
label
description
icon
isCustom
isActive
isNullable
createdAt
updatedAt
settings
isLabelSyncedWithName
}
}
`;
export const UPDATE_ONE_OBJECT_METADATA_ITEM = gql`
mutation UpdateOneObjectMetadataItem(
$idToUpdate: UUID!
$updatePayload: UpdateObjectPayload!
) {
updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {
id
dataSourceId
nameSingular
namePlural
labelSingular
labelPlural
description
icon
isCustom
isActive
createdAt
updatedAt
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
}
}
`;
export const DELETE_ONE_OBJECT_METADATA_ITEM = gql`
mutation DeleteOneObjectMetadataItem($idToDelete: UUID!) {
deleteOneObject(input: { id: $idToDelete }) {
id
dataSourceId
nameSingular
namePlural
labelSingular
labelPlural
description
icon
isCustom
isActive
createdAt
updatedAt
labelIdentifierFieldMetadataId
imageIdentifierFieldMetadataId
}
}
`;
export const DELETE_ONE_FIELD_METADATA_ITEM = gql`
mutation DeleteOneFieldMetadataItem($idToDelete: UUID!) {
deleteOneField(input: { id: $idToDelete }) {
id
type
name
label
description
icon
isCustom
isActive
isNullable
createdAt
updatedAt
settings
}
}
`;
export const DELETE_ONE_RELATION_METADATA_ITEM = gql`
mutation DeleteOneRelationMetadataItem($idToDelete: UUID!) {
deleteOneRelation(input: { id: $idToDelete }) {
id
}
}
`;