Showing scene and channel count on entity page and tile.
This commit is contained in:
@@ -117,6 +117,10 @@ function curateEntity(entity, parent, releases) {
|
||||
if (entity.parent || parent) curatedEntity.parent = curateEntity(entity.parent || parent);
|
||||
if (releases) curatedEntity.releases = releases.map(release => curateRelease(release));
|
||||
|
||||
if (entity.connection) {
|
||||
curatedEntity.sceneTotal = entity.connection.totalCount;
|
||||
}
|
||||
|
||||
return curatedEntity;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
`, {
|
||||
|
||||
Reference in New Issue
Block a user