2019-12-15 22:01:48 +00:00
|
|
|
import { graphql, get } from '../api';
|
2019-12-31 02:12:52 +00:00
|
|
|
import {
|
2020-05-26 23:40:10 +00:00
|
|
|
releaseFields,
|
2020-05-14 02:26:05 +00:00
|
|
|
releasePosterFragment,
|
|
|
|
releaseActorsFragment,
|
|
|
|
releaseTagsFragment,
|
2019-12-31 02:12:52 +00:00
|
|
|
} from '../fragments';
|
2020-05-17 23:22:56 +00:00
|
|
|
import { curateActor, curateRelease } from '../curate';
|
2020-05-07 01:20:51 +00:00
|
|
|
import getDateRange from '../get-date-range';
|
2019-12-15 22:01:48 +00:00
|
|
|
|
2019-11-15 04:10:59 +00:00
|
|
|
function initActorActions(store, _router) {
|
2020-05-26 23:40:10 +00:00
|
|
|
async function fetchActorById({ _commit }, {
|
|
|
|
actorId,
|
|
|
|
limit = 10,
|
|
|
|
pageNumber = 1,
|
|
|
|
range = 'latest',
|
|
|
|
}) {
|
2020-05-14 02:26:05 +00:00
|
|
|
const { before, after, orderBy } = getDateRange(range);
|
2020-05-07 01:20:51 +00:00
|
|
|
|
2020-05-26 23:40:10 +00:00
|
|
|
const { actor, connection: { releases, totalCount } } = await graphql(`
|
2020-01-04 01:51:58 +00:00
|
|
|
query Actor(
|
2020-05-25 02:39:58 +00:00
|
|
|
$actorId: Int!
|
2020-05-26 23:40:10 +00:00
|
|
|
$limit:Int = 10,
|
|
|
|
$offset:Int = 0,
|
2020-01-04 01:51:58 +00:00
|
|
|
$after:Date = "1900-01-01",
|
|
|
|
$before:Date = "2100-01-01",
|
2020-01-08 23:23:37 +00:00
|
|
|
$orderBy:[ReleasesActorsOrderBy!]
|
2020-01-30 22:41:10 +00:00
|
|
|
$exclude: [String!]
|
2020-01-04 01:51:58 +00:00
|
|
|
) {
|
2020-05-25 02:39:58 +00:00
|
|
|
actor(id: $actorId) {
|
2019-12-15 22:01:48 +00:00
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
2020-05-18 02:28:38 +00:00
|
|
|
realName
|
2019-12-16 01:39:13 +00:00
|
|
|
gender
|
2020-05-17 02:59:09 +00:00
|
|
|
dateOfBirth
|
|
|
|
dateOfDeath
|
2019-12-16 01:39:13 +00:00
|
|
|
age
|
2020-05-17 02:59:09 +00:00
|
|
|
ageAtDeath
|
2019-12-16 01:39:13 +00:00
|
|
|
ethnicity
|
2020-05-17 01:00:44 +00:00
|
|
|
cup
|
2019-12-16 01:39:13 +00:00
|
|
|
bust
|
|
|
|
waist
|
|
|
|
hip
|
2020-01-23 21:45:46 +00:00
|
|
|
naturalBoobs
|
2019-12-16 01:39:13 +00:00
|
|
|
heightMetric: height(units:METRIC)
|
|
|
|
heightImperial: height(units:IMPERIAL)
|
|
|
|
weightMetric: weight(units:METRIC)
|
|
|
|
weightImperial: weight(units:IMPERIAL)
|
2020-05-24 01:54:29 +00:00
|
|
|
hairColor
|
|
|
|
hairLength
|
2020-05-18 23:10:32 +00:00
|
|
|
eyes
|
2019-12-16 01:39:13 +00:00
|
|
|
hasTattoos
|
|
|
|
hasPiercings
|
|
|
|
tattoos
|
|
|
|
piercings
|
2020-01-22 21:25:58 +00:00
|
|
|
description
|
2020-05-14 02:26:05 +00:00
|
|
|
createdAt
|
|
|
|
updatedAt
|
2020-06-28 02:22:19 +00:00
|
|
|
entity {
|
2020-03-27 03:39:13 +00:00
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
2020-06-28 02:22:19 +00:00
|
|
|
type
|
|
|
|
parent {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
type
|
|
|
|
}
|
2020-03-27 03:39:13 +00:00
|
|
|
}
|
2020-05-17 01:00:44 +00:00
|
|
|
avatar: avatarMedia {
|
|
|
|
id
|
|
|
|
path
|
|
|
|
thumbnail
|
|
|
|
lazy
|
|
|
|
hash
|
|
|
|
comment
|
|
|
|
copyright
|
2020-05-17 23:22:56 +00:00
|
|
|
sfw: sfwMedia {
|
|
|
|
id
|
|
|
|
thumbnail
|
|
|
|
path
|
|
|
|
comment
|
|
|
|
}
|
2020-05-17 01:00:44 +00:00
|
|
|
}
|
2020-05-16 02:36:45 +00:00
|
|
|
profiles: actorsProfiles {
|
|
|
|
description
|
2020-05-19 02:46:49 +00:00
|
|
|
descriptionHash
|
2020-06-28 02:22:19 +00:00
|
|
|
entity {
|
2020-05-19 02:46:49 +00:00
|
|
|
id
|
|
|
|
name
|
2020-06-28 02:22:19 +00:00
|
|
|
slug
|
|
|
|
type
|
|
|
|
parent {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
type
|
|
|
|
}
|
2020-05-19 02:46:49 +00:00
|
|
|
}
|
2020-05-16 02:36:45 +00:00
|
|
|
avatar: avatarMedia {
|
|
|
|
id
|
|
|
|
path
|
|
|
|
thumbnail
|
|
|
|
lazy
|
2020-05-17 01:00:44 +00:00
|
|
|
hash
|
2020-05-16 02:36:45 +00:00
|
|
|
comment
|
|
|
|
copyright
|
2020-05-17 23:22:56 +00:00
|
|
|
sfw: sfwMedia {
|
|
|
|
id
|
|
|
|
thumbnail
|
|
|
|
path
|
|
|
|
comment
|
|
|
|
}
|
2020-05-16 02:36:45 +00:00
|
|
|
}
|
2019-12-16 01:39:13 +00:00
|
|
|
}
|
|
|
|
birthCity
|
|
|
|
birthState
|
|
|
|
birthCountry: countryByBirthCountryAlpha2 {
|
2019-12-15 22:01:48 +00:00
|
|
|
alpha2
|
|
|
|
name
|
|
|
|
alias
|
|
|
|
}
|
2019-12-16 01:39:13 +00:00
|
|
|
residenceCity
|
|
|
|
residenceState
|
|
|
|
residenceCountry: countryByResidenceCountryAlpha2 {
|
|
|
|
alpha2
|
|
|
|
name
|
|
|
|
alias
|
|
|
|
}
|
2019-12-31 02:12:52 +00:00
|
|
|
social: actorsSocials {
|
2019-12-16 01:39:13 +00:00
|
|
|
id
|
|
|
|
url
|
|
|
|
platform
|
|
|
|
}
|
2019-12-15 22:01:48 +00:00
|
|
|
aliases: actorsByAliasFor {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
2020-05-26 23:40:10 +00:00
|
|
|
releasesConnection: releasesActorsConnection(
|
2020-01-04 01:51:58 +00:00
|
|
|
filter: {
|
|
|
|
release: {
|
|
|
|
date: {
|
|
|
|
lessThan: $before,
|
|
|
|
greaterThan: $after,
|
2020-01-30 22:41:10 +00:00
|
|
|
},
|
2020-05-22 02:32:16 +00:00
|
|
|
releasesTagsConnection: {
|
2020-01-30 22:41:10 +00:00
|
|
|
none: {
|
|
|
|
tag: {
|
|
|
|
slug: {
|
|
|
|
in: $exclude
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-04 01:51:58 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-26 23:40:10 +00:00
|
|
|
}
|
|
|
|
first: $limit
|
|
|
|
offset: $offset
|
2020-01-08 23:23:37 +00:00
|
|
|
orderBy: $orderBy
|
2020-01-04 01:51:58 +00:00
|
|
|
) {
|
2020-05-26 23:40:10 +00:00
|
|
|
releases: nodes {
|
|
|
|
release {
|
|
|
|
id
|
|
|
|
url
|
|
|
|
title
|
|
|
|
date
|
|
|
|
slug
|
|
|
|
${releaseActorsFragment}
|
|
|
|
${releaseTagsFragment}
|
|
|
|
${releasePosterFragment}
|
2020-06-28 02:22:19 +00:00
|
|
|
entity {
|
2020-05-26 23:40:10 +00:00
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
url
|
2020-06-28 02:22:19 +00:00
|
|
|
parent {
|
2020-05-26 23:40:10 +00:00
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-31 02:12:52 +00:00
|
|
|
}
|
2019-12-15 22:01:48 +00:00
|
|
|
}
|
2020-05-26 23:40:10 +00:00
|
|
|
connection: releasesActorsConnection(
|
|
|
|
first: $limit
|
|
|
|
offset: $offset
|
|
|
|
orderBy: $orderBy
|
|
|
|
filter: {
|
|
|
|
actorId: {
|
|
|
|
equalTo: $actorId
|
|
|
|
}
|
|
|
|
or: [
|
|
|
|
{
|
|
|
|
release: {
|
|
|
|
date: {
|
|
|
|
lessThan: $before,
|
|
|
|
greaterThan: $after
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
releases: nodes {
|
|
|
|
release {
|
|
|
|
${releaseFields}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
totalCount
|
|
|
|
}
|
2019-12-15 22:01:48 +00:00
|
|
|
}
|
|
|
|
`, {
|
2020-05-25 02:39:58 +00:00
|
|
|
actorId,
|
2020-05-14 02:26:05 +00:00
|
|
|
limit,
|
2020-05-26 23:40:10 +00:00
|
|
|
offset: Math.max(0, (pageNumber - 1)) * limit,
|
2020-05-14 02:26:05 +00:00
|
|
|
after,
|
|
|
|
before,
|
|
|
|
orderBy: orderBy === 'DATE_DESC' ? 'RELEASE_BY_RELEASE_ID__DATE_DESC' : 'RELEASE_BY_RELEASE_ID__DATE_ASC',
|
|
|
|
exclude: store.state.ui.filter,
|
|
|
|
});
|
2019-12-15 22:01:48 +00:00
|
|
|
|
2020-05-26 23:40:10 +00:00
|
|
|
return {
|
|
|
|
actor: curateActor(actor, null, curateRelease),
|
|
|
|
releases: releases.map(release => curateRelease(release.release)),
|
|
|
|
totalCount,
|
|
|
|
};
|
2020-05-14 02:26:05 +00:00
|
|
|
}
|
2019-12-15 22:01:48 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
async function fetchActors({ _commit }, {
|
2020-05-23 02:32:50 +00:00
|
|
|
limit = 10,
|
|
|
|
pageNumber = 1,
|
2020-05-14 02:26:05 +00:00
|
|
|
letter,
|
|
|
|
gender,
|
|
|
|
}) {
|
|
|
|
const genderFilter = gender === null
|
|
|
|
? 'isNull: true'
|
|
|
|
: `equalTo: "${gender}"`;
|
2020-05-13 21:17:39 +00:00
|
|
|
|
2020-05-23 02:32:50 +00:00
|
|
|
const { connection: { actors, totalCount } } = await graphql(`
|
2020-02-09 04:30:10 +00:00
|
|
|
query Actors(
|
|
|
|
$limit: Int,
|
2020-05-23 02:32:50 +00:00
|
|
|
$offset: Int = 0,
|
2020-02-09 04:30:10 +00:00
|
|
|
$letter: String! = "",
|
|
|
|
) {
|
2020-05-23 02:32:50 +00:00
|
|
|
connection: actorsConnection(
|
|
|
|
first: $limit,
|
|
|
|
offset: $offset
|
|
|
|
orderBy: NAME_ASC
|
2020-02-09 04:30:10 +00:00
|
|
|
filter: {
|
2020-05-17 23:22:56 +00:00
|
|
|
aliasFor: {
|
|
|
|
isNull: true
|
|
|
|
}
|
2020-02-09 04:30:10 +00:00
|
|
|
name: {
|
|
|
|
startsWith: $letter
|
2020-05-17 23:22:56 +00:00
|
|
|
}
|
2020-05-13 21:17:39 +00:00
|
|
|
gender: {
|
|
|
|
${genderFilter}
|
2020-05-17 23:22:56 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-09 04:30:10 +00:00
|
|
|
) {
|
2020-05-23 02:32:50 +00:00
|
|
|
totalCount
|
|
|
|
actors: nodes {
|
2020-05-17 01:00:44 +00:00
|
|
|
id
|
2020-05-23 02:32:50 +00:00
|
|
|
name
|
|
|
|
slug
|
|
|
|
age
|
|
|
|
ageAtDeath
|
|
|
|
dateOfBirth
|
|
|
|
dateOfDeath
|
|
|
|
gender
|
2020-06-28 02:22:19 +00:00
|
|
|
entity {
|
2020-05-23 02:32:50 +00:00
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
2020-06-28 02:22:19 +00:00
|
|
|
type
|
|
|
|
parent {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
type
|
|
|
|
}
|
2020-05-23 02:32:50 +00:00
|
|
|
}
|
|
|
|
avatar: avatarMedia {
|
2020-05-17 23:22:56 +00:00
|
|
|
id
|
|
|
|
path
|
2020-05-23 02:32:50 +00:00
|
|
|
thumbnail
|
|
|
|
lazy
|
2020-05-17 23:22:56 +00:00
|
|
|
comment
|
2020-05-23 02:32:50 +00:00
|
|
|
copyright
|
|
|
|
sfw: sfwMedia {
|
|
|
|
id
|
|
|
|
thumbnail
|
|
|
|
path
|
|
|
|
comment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
birthCountry: countryByBirthCountryAlpha2 {
|
|
|
|
alpha2
|
|
|
|
name
|
|
|
|
alias
|
2020-05-17 23:22:56 +00:00
|
|
|
}
|
2020-05-17 01:00:44 +00:00
|
|
|
}
|
2019-12-15 22:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`, {
|
2020-05-23 02:32:50 +00:00
|
|
|
offset: Math.max(0, (pageNumber - 1)) * limit,
|
2020-05-14 02:26:05 +00:00
|
|
|
limit,
|
|
|
|
letter,
|
|
|
|
});
|
2019-12-15 22:01:48 +00:00
|
|
|
|
2020-05-23 02:32:50 +00:00
|
|
|
return {
|
|
|
|
actors: actors.map(actor => curateActor(actor)),
|
|
|
|
totalCount,
|
|
|
|
};
|
2020-05-14 02:26:05 +00:00
|
|
|
}
|
2019-11-10 03:20:22 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
async function fetchActorReleases({ _commit }, actorId) {
|
|
|
|
const releases = await get(`/actors/${actorId}/releases`, {
|
|
|
|
filter: store.state.ui.filter,
|
|
|
|
after: store.getters.after,
|
|
|
|
before: store.getters.before,
|
|
|
|
});
|
2019-11-10 03:20:22 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
return releases;
|
|
|
|
}
|
2019-11-10 03:20:22 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
return {
|
2020-05-25 02:39:58 +00:00
|
|
|
fetchActorById,
|
2020-05-14 02:26:05 +00:00
|
|
|
fetchActors,
|
|
|
|
fetchActorReleases,
|
|
|
|
};
|
2019-11-10 03:20:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default initActorActions;
|