buildJson method

dynamic buildJson({
  1. bool includeRecordType = true,
})

Implementation

FieldRefInput? buildJson({bool includeRecordType = true}) {
  late dynamic json;
  if (_create != null) {
    json = {"node": _create!.toJson()};
  } else if (_linkedId == null) {
    json = isDisconnect ? {"disconnect": {}} : null;
  } else {
    json = {
      "connect": {
        "where": {
          "node": {
            "id": _linkedId,
          }
        },
        "edge": (_props!.toJson() as Object?)?.withoutKey('node'),
      },
      // "disconnect": {
      //   "where": {
      //     "node": {
      //       "id_NOT": _linkedId,
      //     }
      //   }
      // }
    };
  }
  return (_recordType != null && json != null && includeRecordType == true)
      ? {
          _recordType: json,
        }
      : json;
}