Use correct relation type on junction table setup

This commit is contained in:
rijkvanzanten
2020-09-14 12:55:44 -04:00
parent fb4b64b8db
commit 0c26344f58
2 changed files with 9 additions and 0 deletions

View File

@@ -298,6 +298,10 @@ export default defineComponent({
}
if (relations.length === 2) {
const relationForCurrent = relations.find((relation: Relation) => (relation.many_collection === collection && relation.many_field === field) || (relation.one_collection === collection && relation.one_field === field));
if (relationForCurrent?.many_collection === collection && relationForCurrent?.many_field === field) return 'm2o';
if (
relations[0].one_collection === 'directus_files' ||
relations[1].one_collection === 'directus_files'

View File

@@ -247,6 +247,8 @@ function initLocalStore(
]
}
];
state.relations[0].many_primary = 'id';
}
if (collectionExists(collectionName)) {
@@ -342,6 +344,9 @@ function initLocalStore(
}
]
});
state.relations[0].many_primary = 'id';
state.relations[1].many_primary = 'id';
}
if (fieldExists(junctionCollection, manyCurrent) === false) {