forked from DebaucheryLibrarian/traxxx
Using summaries table for improved performance.
This commit is contained in:
@@ -15,19 +15,19 @@ function initTagsActions(store, _router) {
|
||||
}) {
|
||||
const { before, after, orderBy } = getDateRange(range);
|
||||
|
||||
const { tagBySlug, batches: [lastBatch] } = await graphql(`
|
||||
const { tagBySlug, scenesConnection, batches: [lastBatch] } = await graphql(`
|
||||
query Tag(
|
||||
$tagSlug:String!
|
||||
$tagSlug: String!
|
||||
$offset: Int = 0,
|
||||
$limit:Int = 1000,
|
||||
$after:Datetime = "1900-01-01",
|
||||
$before:Datetime = "2100-01-01",
|
||||
$orderBy: [ReleasesOrderBy!],
|
||||
$orderBy: [ReleasesSummariesOrderBy!],
|
||||
$exclude: [String!]
|
||||
$hasAuth: Boolean!
|
||||
$userId: Int
|
||||
) {
|
||||
tagBySlug(slug:$tagSlug) {
|
||||
tagBySlug(slug: $tagSlug) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
@@ -155,32 +155,25 @@ function initTagsActions(store, _router) {
|
||||
}
|
||||
}
|
||||
}
|
||||
scenesConnection(
|
||||
filter: {
|
||||
effectiveDate: {
|
||||
lessThan: $before,
|
||||
greaterThan: $after,
|
||||
},
|
||||
releasesTagsConnection: {
|
||||
none: {
|
||||
tag: {
|
||||
slug: {
|
||||
in: $exclude
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
first: $limit,
|
||||
orderBy: $orderBy,
|
||||
offset: $offset
|
||||
) {
|
||||
releases: nodes {
|
||||
}
|
||||
scenesConnection: releasesSummariesConnection(
|
||||
first: $limit
|
||||
offset: $offset
|
||||
orderBy: $orderBy
|
||||
filter: {
|
||||
not: { tags: { overlaps: $exclude } }
|
||||
tags: { anyEqualTo: $tagSlug }
|
||||
effectiveDate: { lessThan: $before, greaterThan: $after }
|
||||
showcased: { equalTo: true }
|
||||
}
|
||||
) {
|
||||
releases: nodes {
|
||||
release {
|
||||
${releaseFields}
|
||||
}
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
totalCount
|
||||
}
|
||||
${batchFragment}
|
||||
}
|
||||
`, {
|
||||
@@ -197,8 +190,8 @@ function initTagsActions(store, _router) {
|
||||
|
||||
return {
|
||||
tag: curateTag(tagBySlug, null, curateRelease),
|
||||
releases: tagBySlug.scenesConnection.releases.map((release) => curateRelease(release, 'scene', { lastBatch: lastBatch.id })),
|
||||
totalCount: tagBySlug.scenesConnection.totalCount,
|
||||
releases: scenesConnection.releases.map(({ release }) => curateRelease(release, 'scene', { lastBatch: lastBatch.id })),
|
||||
totalCount: scenesConnection.totalCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user