Skip to content

Commit e842619

Browse files
Travis Sheppardragingsquirrel3
authored andcommitted
chore(api): correct a few conflicts
fixes some conflicts from cherry-picking 156d0e2 from main
1 parent 279ac8e commit e842619

File tree

13 files changed

+610
-790
lines changed

13 files changed

+610
-790
lines changed

packages/amplify_test/lib/test_models/many_to_many/ModelProvider.dart

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/api/amplify_api_dart/lib/src/graphql/factories/graphql_request_factory.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,10 @@ class GraphQLRequestFactory {
215215

216216
// e.g. { 'name': { 'eq': 'foo }}
217217
if (queryPredicate is QueryPredicateOperation) {
218+
final association = schema.fields?[queryPredicate.field]?.association;
219+
// TODO(ragingsquirrel3): Change key logic when supporting CPK.
218220
final associatedTargetName =
219-
schema.fields?[queryPredicate.field]?.association?.targetName;
221+
association?.targetNames?.first ?? association?.targetName;
220222
var fieldName = queryPredicate.field;
221223
if (queryPredicate.field ==
222224
'${_lowerCaseFirstCharacter(schema.name)}.$idFieldName') {
@@ -292,7 +294,9 @@ class GraphQLRequestFactory {
292294
final allBelongsTo = getBelongsToFieldsFromModelSchema(schema);
293295
for (final belongsTo in allBelongsTo) {
294296
final belongsToModelName = belongsTo.name;
295-
final belongsToKey = belongsTo.association?.targetName;
297+
// TODO(ragingsquirrel3): Change key logic when supporting CPK.
298+
final belongsToKey = belongsTo.association?.targetNames?.first ??
299+
belongsTo.association?.targetName;
296300
final belongsToValue =
297301
(modelJson[belongsToModelName] as Map?)?[idFieldName] as String?;
298302

packages/api/amplify_api_dart/test/graphql_helpers_mtm_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ void main() {
6565
final expectedVars = {
6666
'input': {
6767
'id': 'firstMtmRelationId',
68-
'manyToManyPrimaryID': 'mtmPrimaryId',
69-
'manyToManySecondaryID': 'mtmSecondaryId'
68+
'manyToManyPrimaryId': 'mtmPrimaryId',
69+
'manyToManySecondaryId': 'mtmSecondaryId'
7070
}
7171
};
7272

@@ -102,8 +102,8 @@ void main() {
102102
final expectedVars = {
103103
'input': {
104104
'id': 'firstMtmRelationId',
105-
'manyToManyPrimaryID': 'mtmPrimaryId',
106-
'manyToManySecondaryID': 'mtmSecondaryId'
105+
'manyToManyPrimaryId': 'mtmPrimaryId',
106+
'manyToManySecondaryId': 'mtmSecondaryId'
107107
},
108108
'condition': null
109109
};

0 commit comments

Comments
 (0)