Using effective date in all queries.

This commit is contained in:
DebaucheryLibrarian 2023-07-02 22:21:19 +02:00
parent 3c8b6e6fc1
commit 0a27e91de7
5 changed files with 18 additions and 83 deletions

View File

@ -37,8 +37,6 @@ function initActorActions(store, router) {
$offset:Int = 0, $offset:Int = 0,
$after:Datetime = "1900-01-01", $after:Datetime = "1900-01-01",
$before:Datetime = "2100-01-01", $before:Datetime = "2100-01-01",
$afterTime:Datetime = "1900-01-01",
$beforeTime:Datetime = "2100-01-01",
$orderBy:[ReleasesOrderBy!] $orderBy:[ReleasesOrderBy!]
$selectableTags: [String], $selectableTags: [String],
$includedTags: [String!], $includedTags: [String!],
@ -206,23 +204,10 @@ function initActorActions(store, router) {
} }
scenesConnection( scenesConnection(
filter: { filter: {
or: [ effectiveDate: {
{
date: {
lessThan: $before, lessThan: $before,
greaterThan: $after greaterThan: $after
} }
},
{
date: {
isNull: true
},
createdAt: {
lessThan: $beforeTime,
greaterThan: $afterTime,
}
}
]
and: [ and: [
{ {
or: $includedEntities or: $includedEntities
@ -264,8 +249,6 @@ function initActorActions(store, router) {
offset: Math.max(0, (pageNumber - 1)) * limit, offset: Math.max(0, (pageNumber - 1)) * limit,
after, after,
before, before,
afterTime: store.getters.after,
beforeTime: store.getters.before,
selectableTags: config.selectableTags, selectableTags: config.selectableTags,
orderBy, orderBy,
exclude: store.state.ui.tagFilter, exclude: store.state.ui.tagFilter,

View File

@ -419,7 +419,7 @@ const releasesFragment = `
connection: releasesConnection( connection: releasesConnection(
filter: { filter: {
releasesNotShowcasedsConnectionExist: false releasesNotShowcasedsConnectionExist: false
date: { effectiveDate: {
lessThan: $before, lessThan: $before,
greaterThan: $after greaterThan: $after
} }
@ -444,40 +444,6 @@ const releasesFragment = `
} }
`; `;
// unused due performance
const releasesShowcasedFragment = `
connection: releasesShowcasedsConnection(
filter: {
release: {
date: {
lessThan: $before,
greaterThan: $after
}
releasesTagsConnection: {
none: {
tag: {
or: [
{ slug: { in: $exclude } }
{ name: { in: $exclude } }
]
}
}
}
}
},
first: $limit,
offset: $offset,
orderBy: $orderBy
) {
releases: nodes {
release {
${releaseFields}
}
}
totalCount
}
`;
const mediaFields = ` const mediaFields = `
id id
index index
@ -715,7 +681,6 @@ export {
releasePhotosFragment, releasePhotosFragment,
releaseTrailerFragment, releaseTrailerFragment,
releasesFragment, releasesFragment,
releasesShowcasedFragment,
releaseFragment, releaseFragment,
siteFragment, siteFragment,
sitesFragment, sitesFragment,

View File

@ -1,7 +1,7 @@
import { graphql } from '../api'; import { graphql } from '../api';
// import { sitesFragment, releaseFields } from '../fragments'; // import { sitesFragment, releaseFields } from '../fragments';
import { releaseFields } from '../fragments'; import { releaseFields } from '../fragments';
import { curateNetwork } from '../curate'; import { curateEntity } from '../curate';
import getDateRange from '../get-date-range'; import getDateRange from '../get-date-range';
function initNetworksActions(store, _router) { function initNetworksActions(store, _router) {
@ -59,23 +59,10 @@ function initNetworksActions(store, _router) {
{ parent: { parent: { slug: { equalTo: $networkSlug } } } } { parent: { parent: { slug: { equalTo: $networkSlug } } } }
] ]
} }
or: [ effectiveDate: {
{
date: {
lessThan: $before, lessThan: $before,
greaterThan: $after greaterThan: $after
} }
},
{
date: {
isNull: true
},
createdAt: {
lessThan: $beforeTime,
greaterThan: $afterTime,
}
}
]
releasesTagsConnection: { releasesTagsConnection: {
none: { none: {
tag: { tag: {
@ -106,7 +93,7 @@ function initNetworksActions(store, _router) {
}); });
return { return {
network: curateNetwork(network, releases), network: curateEntity(network, releases),
totalCount, totalCount,
}; };
} }
@ -131,7 +118,7 @@ function initNetworksActions(store, _router) {
} }
`); `);
return networks.map(network => curateNetwork(network)); return networks.map((network) => curateEntity(network));
} }
return { return {

View File

@ -1,6 +1,6 @@
import { graphql } from '../api'; import { graphql } from '../api';
import { releaseFields } from '../fragments'; import { releaseFields } from '../fragments';
import { curateSite, curateRelease } from '../curate'; import { curateEntity, curateRelease } from '../curate';
import getDateRange from '../get-date-range'; import getDateRange from '../get-date-range';
function initSitesActions(store, _router) { function initSitesActions(store, _router) {
@ -41,7 +41,7 @@ function initSitesActions(store, _router) {
} }
releasesConnection( releasesConnection(
filter: { filter: {
date: { effectiveDate: {
lessThan: $before, lessThan: $before,
greaterThan: $after, greaterThan: $after,
}, },
@ -75,7 +75,7 @@ function initSitesActions(store, _router) {
equalTo: $siteSlug equalTo: $siteSlug
} }
} }
date: { effectiveDate: {
lessThan: $before, lessThan: $before,
greaterThan: $after greaterThan: $after
} }
@ -107,8 +107,8 @@ function initSitesActions(store, _router) {
}); });
return { return {
site: curateSite(site), site: curateEntity(site),
releases: releases.map(release => curateRelease(release)), releases: releases.map((release) => curateRelease(release)),
totalCount, totalCount,
}; };
} }

View File

@ -157,7 +157,7 @@ function initTagsActions(store, _router) {
} }
scenesConnection( scenesConnection(
filter: { filter: {
date: { effectiveDate: {
lessThan: $before, lessThan: $before,
greaterThan: $after, greaterThan: $after,
}, },