Closes https://github.com/twentyhq/core-team-issues/issues/1628 From a technical perspective, we can add more ordering options, such as the ability to combine two sorts on the X axis, e.g. sort by Close date ASC and then by Sum ASC, which will sort groups that have the same close date between themselves depending on their sum ASC. @Bonapara could you provide design if you want this to be implemented (quite short on our hand i think - maybe in V2 though)? https://github.com/user-attachments/assets/6ef21fe1-9d8f-43c0-bfa2-f6fc6341cacf --------- Co-authored-by: ehconitin <nitinkoche03@gmail.com>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { createOneOperationFactory } from 'test/integration/graphql/utils/create-one-operation-factory.util';
|
|
import { makeGraphqlAPIRequest } from 'test/integration/graphql/utils/make-graphql-api-request.util';
|
|
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
|
|
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
|
|
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
|
|
import { type ObjectRecord } from 'twenty-shared/types';
|
|
import { capitalize } from 'twenty-shared/utils';
|
|
|
|
type CreateOneOperationArgs<T> = PerformMetadataQueryParams<T> & {
|
|
objectMetadataSingularName: string;
|
|
};
|
|
export const createOneOperation = async <T = object>({
|
|
input,
|
|
gqlFields = 'id',
|
|
objectMetadataSingularName,
|
|
expectToFail = false,
|
|
}: CreateOneOperationArgs<T>): CommonResponseBody<{
|
|
createOneResponse: ObjectRecord;
|
|
}> => {
|
|
const graphqlOperation = createOneOperationFactory({
|
|
data: input as object, // TODO default generic does not work
|
|
objectMetadataSingularName,
|
|
gqlFields,
|
|
});
|
|
|
|
const response = await makeGraphqlAPIRequest(graphqlOperation);
|
|
|
|
if (expectToFail) {
|
|
warnIfNoErrorButExpectedToFail({
|
|
response,
|
|
errorMessage: 'Create one operation should have failed but did not',
|
|
});
|
|
}
|
|
|
|
return {
|
|
data: {
|
|
createOneResponse:
|
|
response.body.data[`create${capitalize(objectMetadataSingularName)}`],
|
|
},
|
|
errors: response.body.errors,
|
|
};
|
|
};
|