Slide 26
Slide 26 text
Although called „query language“ GraphQL
also supports changing data by „mutations“
26
type Mutation {
createProject(
projectName: String!,
plannedStartDate: Date!,
deadline: Date!,
companyId: String!): ID!
}
@Controller
class ProjectController(…) {
@MutationMapping
fun createProject(
@Argument projectName: String,
@Argument plannedStartDate: LocalDate,
@Argument deadline: LocalDate,
@Argument companyId: CompanyId
): CompletableFuture = { … }
}
HTTP Request
mutation {
createProject(
projectName: “Prepare Spring IO Talk",
plannedStartDate: "2022-01-01",
deadline: "2022-05-25",
….
) { identifier }
}