forked from DebaucheryLibrarian/traxxx
Added sections and pagination to stash page.
This commit is contained in:
@@ -5,14 +5,24 @@ import {
|
||||
patch,
|
||||
} from '../api';
|
||||
|
||||
import { releaseFields, actorStashesFields } from '../fragments';
|
||||
import { releaseFields, actorStashesFields, movieFields } from '../fragments';
|
||||
import { curateStash } from '../curate';
|
||||
|
||||
function initStashesActions(store, _router) {
|
||||
async function fetchStash(context, stashId) {
|
||||
async function fetchStash(context, {
|
||||
stashId,
|
||||
section = 'scenes',
|
||||
pageNumber = 1,
|
||||
limit = 20,
|
||||
}) {
|
||||
const { stash } = await graphql(`
|
||||
query Stash(
|
||||
$stashId: Int!
|
||||
$includeScenes: Boolean!
|
||||
$includeActors: Boolean!
|
||||
$includeMovies: Boolean!
|
||||
$limit:Int = 10,
|
||||
$offset:Int = 0,
|
||||
$hasAuth: Boolean!
|
||||
$userId: Int
|
||||
) {
|
||||
@@ -26,45 +36,77 @@ function initStashesActions(store, _router) {
|
||||
id
|
||||
username
|
||||
}
|
||||
actors: stashesActors {
|
||||
comment
|
||||
actor {
|
||||
id
|
||||
name
|
||||
slug
|
||||
gender
|
||||
age
|
||||
ageFromBirth
|
||||
dateOfBirth
|
||||
birthCity
|
||||
birthState
|
||||
birthCountry: countryByBirthCountryAlpha2 {
|
||||
alpha2
|
||||
name
|
||||
alias
|
||||
}
|
||||
avatar: avatarMedia {
|
||||
actorsConnection: stashesActorsConnection(
|
||||
orderBy: CREATED_AT_DESC
|
||||
first: $limit
|
||||
offset: $offset
|
||||
) @include(if: $includeActors) {
|
||||
totalCount
|
||||
actors: nodes {
|
||||
comment
|
||||
actor {
|
||||
id
|
||||
path
|
||||
thumbnail
|
||||
lazy
|
||||
isS3
|
||||
width
|
||||
height
|
||||
name
|
||||
slug
|
||||
gender
|
||||
age
|
||||
ageFromBirth
|
||||
dateOfBirth
|
||||
birthCity
|
||||
birthState
|
||||
birthCountry: countryByBirthCountryAlpha2 {
|
||||
alpha2
|
||||
name
|
||||
alias
|
||||
}
|
||||
avatar: avatarMedia {
|
||||
id
|
||||
path
|
||||
thumbnail
|
||||
lazy
|
||||
isS3
|
||||
width
|
||||
height
|
||||
}
|
||||
${actorStashesFields}
|
||||
}
|
||||
${actorStashesFields}
|
||||
}
|
||||
}
|
||||
scenes: stashesScenes {
|
||||
comment
|
||||
scene {
|
||||
${releaseFields}
|
||||
scenesConnection: stashesScenesConnection(
|
||||
orderBy: CREATED_AT_DESC
|
||||
first: $limit
|
||||
offset: $offset
|
||||
) @include(if: $includeScenes) {
|
||||
totalCount
|
||||
scenes: nodes {
|
||||
comment
|
||||
scene {
|
||||
${releaseFields}
|
||||
}
|
||||
}
|
||||
}
|
||||
moviesConnection: stashesMoviesConnection(
|
||||
orderBy: CREATED_AT_DESC
|
||||
first: $limit
|
||||
offset: $offset
|
||||
) @include(if: $includeMovies) {
|
||||
totalCount
|
||||
movies: nodes {
|
||||
comment
|
||||
movie {
|
||||
${movieFields}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`, {
|
||||
stashId: Number(stashId),
|
||||
includeScenes: section === 'scenes',
|
||||
includeActors: section === 'actors',
|
||||
includeMovies: section === 'movies',
|
||||
offset: Math.max(0, (pageNumber - 1)) * limit,
|
||||
limit: Number(limit),
|
||||
hasAuth: !!store.state.auth.user,
|
||||
userId: store.state.auth.user?.id,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user