Skip to content

Commit

Permalink
feat: make addReportingRequirementToRevision mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
BCerki committed May 13, 2022
1 parent 34e04af commit 27e08df
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { graphql } from "react-relay";
import useMutationWithErrorMessage from "mutations/useMutationWithErrorMessage";
import { addReportingRequirementToRevisionMutation } from "__generated__/addReportingRequirementToRevisionMutation.graphql";

export const mutation = graphql`
mutation addReportingRequirementToRevisionMutation(
$connections: [ID!]!
$projectRevisionId: Int!
$newFormData: JSON!
) {
createFormChange(
input: {
formDataSchemaName: "cif"
formDataTableName: "reporting_requirement"
jsonSchemaName: "reporting_requirement"
operation: CREATE
projectRevisionId: $projectRevisionId
newFormData: $newFormData
}
) {
formChangeEdge @appendEdge(connections: $connections) {
cursor
node {
id
newFormData
projectRevisionByProjectRevisionId {
...ProjectQuarterlyReportsForm_projectRevision
...TaskList_projectRevision
}
}
}
}
}
`;

export const useAddReportingRequirementToRevision = () =>
useMutationWithErrorMessage<addReportingRequirementToRevisionMutation>(
mutation,
() => "An error occurred while attempting to create the project revision."
);

0 comments on commit 27e08df

Please sign in to comment.