diff --git a/package-lock.json b/package-lock.json index 4d296a98..0ccdce67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "lodash": "^4.17.21", "react": "^18.3.1", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#0a4e249", + "terraso-backend": "github:techmatters/terraso-backend#7b7346d", "uuid": "^10.0.0" }, "devDependencies": { @@ -13685,8 +13685,7 @@ }, "node_modules/terraso-backend": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#b61c60caf963a400bffa8016cb6f894d5d9d72b4", - "integrity": "sha512-rM6ZXO+dX5GT3QuERDJ5PW03O1buJdD7DOkFiMnKbvQobAT+L71NypMKsZrcfxi4+6gT2dYo1j/5EmkFQxVoJQ==" + "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#7b7346db6941a03eb67de9d6cdbd8e915b7acb18" }, "node_modules/test-exclude": { "version": "6.0.0", diff --git a/package.json b/package.json index f4c632da..b05e5588 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lodash": "^4.17.21", "react": "^18.3.1", "react-redux": "^8.1.3", - "terraso-backend": "github:techmatters/terraso-backend#0a4e249", + "terraso-backend": "github:techmatters/terraso-backend#7b7346d", "uuid": "^10.0.0" }, "scripts": { diff --git a/src/soilId/soilDataService.ts b/src/soilId/soilDataService.ts index dcc756da..4940e7cb 100644 --- a/src/soilId/soilDataService.ts +++ b/src/soilId/soilDataService.ts @@ -22,6 +22,7 @@ import type { ProjectSoilSettingsUpdateDepthIntervalMutationInput, ProjectSoilSettingsUpdateMutationInput, SoilDataDeleteDepthIntervalMutationInput, + SoilDataPushInput, SoilDataUpdateDepthIntervalMutationInput, SoilDataUpdateMutationInput, } from 'terraso-client-shared/graphqlSchema/graphql'; @@ -236,3 +237,32 @@ export const deleteProjectDepthInterval = async ( const resp = await terrasoApi.requestGraphQL(query, { input: depthInterval }); return resp.deleteProjectSoilSettingsDepthInterval.projectSoilSettings!; }; + +export const pushSoilData = async (depthInterval: SoilDataPushInput) => { + const query = graphql(` + mutation pushSoilData($input: SoilDataPushInput!) { + pushSoilData(input: $input) { + results { + siteId + result { + __typename + ... on SoilDataPushEntryFailure { + reason + } + ... on SoilDataPushEntrySuccess { + site { + soilData { + ...soilData + } + } + } + } + } + errors + } + } + `); + + const resp = await terrasoApi.requestGraphQL(query, { input: depthInterval }); + return resp.pushSoilData.results!; +};