Showing scene and channel count on entity page and tile.

This commit is contained in:
DebaucheryLibrarian
2021-10-30 22:41:58 +02:00
parent 8322d43b09
commit b764fdec85
8 changed files with 168 additions and 112 deletions

View File

@@ -14,7 +14,7 @@ function initEntitiesActions(store, router) {
}) {
const { before, after, orderBy } = getDateRange(range);
const { entity, connection: { releases, totalCount } } = await graphql(`
const { entity } = await graphql(`
query Entity(
$entitySlug: String!
$entityType: String! = "channel"
@@ -64,6 +64,12 @@ function initEntitiesActions(store, router) {
independent
hasLogo
${campaignsFragment}
children: childEntitiesConnection {
totalCount
}
connection: scenesConnection {
totalCount
}
}
}
${campaignsFragment}
@@ -77,82 +83,45 @@ function initEntitiesActions(store, router) {
hasLogo
${campaignsFragment}
}
}
connection: releasesConnection(
first: $limit
offset: $offset
orderBy: $orderBy
filter: {
and: [
{
entity: {
or: [
{
slug: { equalTo: $entitySlug }
},
{
parent: {
slug: { equalTo: $entitySlug }
type: { equalTo: $entityType }
}
},
{
parent: {
parent: {
slug: { equalTo: $entitySlug }
type: { equalTo: $entityType }
}
}
}
{
parent: {
parent: {
parent: {
slug: { equalTo: $entitySlug }
type: { equalTo: $entityType }
}
},
},
},
]
}
}
{
or: [
{
date: {
lessThan: $before,
greaterThan: $after
}
},
{
date: {
isNull: true
},
createdAt: {
lessThan: $beforeTime,
greaterThan: $afterTime,
}
connection: scenesConnection(
first: $limit
offset: $offset
orderBy: $orderBy
filter: {
or: [
{
date: {
lessThan: $before,
greaterThan: $after
}
]
}
]
releasesTagsConnection: {
none: {
tag: {
slug: {
in: $exclude
},
{
date: {
isNull: true
},
createdAt: {
lessThan: $beforeTime,
greaterThan: $afterTime,
}
}
]
releasesTagsConnection: {
none: {
tag: {
slug: {
in: $exclude
}
}
}
}
}
) {
releases: nodes {
${releaseFields}
}
totalCount
}
) {
releases: nodes {
${releaseFields}
}
totalCount
}
}
}
`, {
entitySlug,
@@ -175,8 +144,8 @@ function initEntitiesActions(store, router) {
}
return {
entity: curateEntity(entity, null, releases),
totalCount,
entity: curateEntity(entity, null, entity.connection.releases),
totalCount: entity.connection.totalCount,
};
}
@@ -233,6 +202,9 @@ function initEntitiesActions(store, router) {
children: childEntitiesConnection {
totalCount
}
connection: scenesConnection {
totalCount
}
}
}
`, {