Added stash menu to release page, returning stashes from stash API to avoid reloading or local interpolation.
This commit is contained in:
@@ -12,23 +12,35 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
||||
}
|
||||
|
||||
extend type Actor {
|
||||
isStashed: Boolean @requires(columns: ["stashesActors"])
|
||||
isFavorited: Boolean @requires(columns: ["stashesActors"])
|
||||
isStashed(includeFavorites: Boolean = false): Boolean @requires(columns: ["stashesActors"])
|
||||
ageFromBirth: Int @requires(columns: ["dateOfBirth"])
|
||||
ageAtDeath: Int @requires(columns: ["dateOfBirth", "dateOfDeath"])
|
||||
height(units:Units): String @requires(columns: ["height"])
|
||||
weight(units:Units): String @requires(columns: ["weight"])
|
||||
penisLength(units:Units): String @requires(columns: ["penis_length"])
|
||||
penisGirth(units:Units): String @requires(columns: ["penis_girth"])
|
||||
height(units: Units): String @requires(columns: ["height"])
|
||||
weight(units: Units): String @requires(columns: ["weight"])
|
||||
penisLength(units: Units): String @requires(columns: ["penis_length"])
|
||||
penisGirth(units: Units): String @requires(columns: ["penis_girth"])
|
||||
}
|
||||
`,
|
||||
resolvers: {
|
||||
Actor: {
|
||||
isStashed(parent) {
|
||||
if (!parent['@stashes']) {
|
||||
isFavorited(parent) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return parent['@stashes'].length > 0;
|
||||
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
||||
},
|
||||
isStashed(parent, args) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.includeFavorites) {
|
||||
return parent['@stashes'].length > 0;
|
||||
}
|
||||
|
||||
return parent['@stashes'].some(({ '@stash': stash }) => !stash.primary);
|
||||
},
|
||||
ageFromBirth(parent, _args, _context, _info) {
|
||||
if (!parent.dateOfBirth) return null;
|
||||
|
||||
@@ -5,17 +5,29 @@ const { makeExtendSchemaPlugin, gql } = require('graphile-utils');
|
||||
const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
||||
typeDefs: gql`
|
||||
extend type Release {
|
||||
isStashed: Boolean @requires(columns: ["stashesScenesBySceneId"])
|
||||
isFavorited: Boolean @requires(columns: ["stashesScenesBySceneId"])
|
||||
isStashed(includeFavorites: Boolean = false): Boolean @requires(columns: ["stashesScenesBySceneId"])
|
||||
}
|
||||
`,
|
||||
resolvers: {
|
||||
Release: {
|
||||
isStashed(parent) {
|
||||
if (!parent['@stashes']) {
|
||||
isFavorited(parent) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return parent['@stashes'].length > 0;
|
||||
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
||||
},
|
||||
isStashed(parent, args) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.includeFavorites) {
|
||||
return parent['@stashes'].length > 0;
|
||||
}
|
||||
|
||||
return parent['@stashes'].some(({ '@stash': stash }) => !stash.primary);
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user