mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-26 13:31:45 +03:00
cf67ed09d0
This PR introduces an `upsert` parameter (along the existing `data` param) for `createOne` and `createMany` mutations. When upsert is set to `true`, the function will look for records with the same id if an id was passed. If not id was passed, it will leverage the existing duplicate check mechanism to find a duplicate. If a record is found, then the function will perform an update instead of a create. Unfortunately I had to remove some nice tests that existing on the args factory. Those tests where mostly testing the duplication rule generation logic but through a GraphQL angle. Since I moved the duplication rule logic to a dedicated service, if I kept the tests but mocked the service we wouldn't really be testing anything useful. The right path would be to create new tests for this service that compare the JSON output and not the GraphQL output but I chose not to work on this as it's equivalent to rewriting the tests from scratch and I have other competing priorities.
33 lines
829 B
JavaScript
33 lines
829 B
JavaScript
module.exports = {
|
|
schema: (process.env.REACT_APP_SERVER_BASE_URL ?? 'http://localhost:3000') + '/graphql',
|
|
documents: [
|
|
'!./src/modules/databases/**',
|
|
'!./src/modules/object-metadata/**',
|
|
'!./src/modules/object-record/**',
|
|
'./src/modules/**/*.tsx',
|
|
'./src/modules/**/*.ts',
|
|
'!./src/**/*.test.tsx',
|
|
'!./src/**/__mocks__/*.ts',
|
|
'!./src/modules/users/graphql/queries/getCurrentUserAndViews.ts',
|
|
],
|
|
overwrite: true,
|
|
generates: {
|
|
'./src/generated/graphql.tsx': {
|
|
plugins: [
|
|
'typescript',
|
|
'typescript-operations',
|
|
'typescript-react-apollo',
|
|
],
|
|
config: {
|
|
skipTypename: false,
|
|
withHooks: true,
|
|
withHOC: false,
|
|
withComponent: false,
|
|
scalars: {
|
|
DateTime: 'string',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|