Skip to content

Commit

Permalink
feat: expose pushSoilData endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouxm committed Oct 29, 2024
1 parent cbab96e commit dbe405e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
30 changes: 30 additions & 0 deletions src/soilId/soilDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
ProjectSoilSettingsUpdateDepthIntervalMutationInput,
ProjectSoilSettingsUpdateMutationInput,
SoilDataDeleteDepthIntervalMutationInput,
SoilDataPushInput,
SoilDataUpdateDepthIntervalMutationInput,
SoilDataUpdateMutationInput,
} from 'terraso-client-shared/graphqlSchema/graphql';
Expand Down Expand Up @@ -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!;
};

0 comments on commit dbe405e

Please sign in to comment.