I'm using react + graphql with apollo client in my frontend and graphene + python for the backend
I have a mutation to update or add a new course like described below:
import { gql } from "@apollo/client";
const ADD_OR_UPDATE_COURSE = gql`
mutation AddCourse($id: ID, $description: String, $name: String!, $orgId: ID!){
addCourse(id: $id,description: $description, name: $name, orgId: $orgId)
{
course {
id
name
description
}
}
}`;
export default ADD_OR_UPDATE_COURSE;
This is fine for adding a single course, but I'd like to be able to add multiple courses without having to send a new request to backend multiple times.
The answer by Daniel in this post and the one by marktani in this other post almost give me what I need, except that I would like this to be dynamic, without knowing before hand how many insertions will be.
It has been awhile since their posts, so I was wondering if today there's an easy solution to this, or should I just to ahead and modify my backend side for a mutation that accepts a list instead of single course?