I'm using DynamoDB of AWS and i'm trying to insert item with relations (hasMany). When i'm trying to create item with relations it returns error:
"The variables input contains a field name 'contacts' that is not defined for input object type 'CreateBookingInput' "
Here is the definition of my models where you can see the relations
type Traineeship @model @auth(rules:[{allow:public}]){
traineeshipID: ID! @primaryKey
}
type Booking @model @auth(rules:[{allow:public}]){
bookingID: ID! @primaryKey
traineeship: Traineeship @hasOne
contacts:[BookingContact] @hasMany
}
type BookingContact @model @auth(rules:[{allow:public}]){
bookingContactID: ID! @primaryKey
}
And here is the mutation use to insert
export const createBooking = /* GraphQL */ `
mutation CreateBooking(
$input: CreateBookingInput!
$condition: ModelBookingConditionInput
) {
createBooking(input: $input, condition: $condition) {
bookingID
traineeship {
traineeshipID
title
description
fulldesc
place
from
to
price
img
horaire
garderie
age
full
createdAt
updatedAt
}
email
tel
firstname
name
birthdate
address
zipcode
city
Remark
submitedDate
validatedDate
validated
contacts {
items {
bookingContactID
firstname
name
phone
parent
createdAt
updatedAt
bookingContactsId
}
nextToken
}
createdAt
updatedAt
bookingTraineeshipId
}
}
`;
As you can see contacts is define in createBooking. If i remove this property it works correctly.
THanks for your help