Files
twenty/packages/twenty-server/test/integration/graphql/utils/delete-many-operation-factory.util.ts
T
Marie 1ad8c05fbc groupBy fix + typeMapper fix (#15433)
groupBy fix: when a group's dimension value is NULL, we need to adapt
the raw sql (stage: NULL -> stage IS NULL)

typeMapper fix: a graphql type should be made non-nullable if was
indicated so + does not have a default value. our check on not having a
default value was limited to having a null defaultValue instead of
having a null or undefined defaultValue. This is a breaking change, but
all the queries that were providing a null value for these args were not
functioning anyway, and luckily in the FE we declared all queries adding
a `!` already.
2025-10-30 10:14:56 +00:00

30 lines
712 B
TypeScript

import gql from 'graphql-tag';
import { capitalize } from 'twenty-shared/utils';
type DeleteManyOperationFactoryParams = {
objectMetadataSingularName: string;
objectMetadataPluralName: string;
gqlFields: string;
filter?: object;
};
export const deleteManyOperationFactory = ({
objectMetadataSingularName,
objectMetadataPluralName,
gqlFields,
filter = {},
}: DeleteManyOperationFactoryParams) => ({
query: gql`
mutation Delete${capitalize(objectMetadataPluralName)}(
$filter: ${capitalize(objectMetadataSingularName)}FilterInput!
) {
delete${capitalize(objectMetadataPluralName)}(filter: $filter) {
${gqlFields}
}
}
`,
variables: {
filter,
},
});