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

View File

@ -419,7 +419,7 @@ const releasesFragment = `
connection: releasesConnection(
filter: {
releasesNotShowcasedsConnectionExist: false
date: {
effectiveDate: {
lessThan: $before,
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 = `
id
index
@ -715,7 +681,6 @@ export {
releasePhotosFragment,
releaseTrailerFragment,
releasesFragment,
releasesShowcasedFragment,
releaseFragment,
siteFragment,
sitesFragment,

View File

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

View File

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

View File

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