mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Use correct relation type on junction table setup
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user