Hello
I have been searching but cannot find a satisfactory answer on this.
Y have:
type Country {
countryId: ID
name: String!
shortName: String!
companies: [Company] @relation(name: "LOCATED_IN", direction: "IN")
}
type Company {
companyId: ID
name: String!
language: String
countries: [Country] @relation(name: "LOCATED_IN", direction: "OUT")
}
By default, mutations and queries are automatically generated.
For create:
CreateCompany(
companyId: ID
name: String!
language: String
): Company
CreateCountry(
countryId: ID
name: String!
shortName: String!
): Country
For relationship:
AddCountryCompanies(
from: _CompanyInput!
to: _CountryInput!
): _AddCountryCompaniesPayload
In this way, to generate the relationship between a Country and a Company, I must have the country created first.
Then when creating the company, it only allows me to create it, but not to create the reaction. Only after creating the company, can I create the relationship with: "AddCountryCompanies".
is it possible to nest mutation CreateCompany with AddCountryCompanies? in the same request or is it necessary to create a custom mutation?
In the latter case, what would the mutation look like:
type Mutation {
CreateCompany(
name: String!
language: String
plan: Plans
countries: [Country] @relation(name: "LOCATED_IN", direction: "OUT")
): Company
}
????????