Entity refactor. Facilitating channels without parent.

This commit is contained in:
2020-06-28 00:15:13 +02:00
parent 0e8b4caac3
commit 3462d7af2a
50 changed files with 934 additions and 1964 deletions

View File

@@ -57,6 +57,7 @@ function initEntitiesActions(store, _router) {
filter: {
entity: {
or: [
{ slug: { equalTo: $entitySlug } },
{ parent: { slug: { equalTo: $entitySlug } } },
{ parent: { parent: { slug: { equalTo: $entitySlug } } } }
]
@@ -114,17 +115,27 @@ function initEntitiesActions(store, _router) {
};
}
async function fetchEntities({ _commit }, { type }) {
async function fetchEntities({ _commit }, { type, entitySlugs }) {
const { entities } = await graphql(`
query Entities(
$type: String! = "network"
$entitySlugs: [String!] = []
) {
entities(
orderBy: NAME_ASC
filter: {
type: {
equalTo: $type
}
or: [
{
type: {
equalTo: $type
}
}
{
slug: {
in: $entitySlugs
}
}
]
}
) {
id
@@ -134,7 +145,10 @@ function initEntitiesActions(store, _router) {
url
}
}
`, { type });
`, {
type,
entitySlugs,
});
return entities.map(entity => curateEntity(entity));
}