Fixed add stash in notifications panel. Fixed iframe ads breaking page width. Improved actor and movie tile size in search results.
This commit is contained in:
@@ -327,6 +327,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
|
||||
title_filtered=7,
|
||||
actors=10,
|
||||
tags=9,
|
||||
movies=7,
|
||||
meta=6,
|
||||
channel_name=2,
|
||||
channel_slug=3,
|
||||
|
||||
@@ -1,7 +1,50 @@
|
||||
import { fetchEntities } from '../entities.js';
|
||||
import {
|
||||
fetchEntities,
|
||||
fetchEntitiesById,
|
||||
} from '../entities.js';
|
||||
|
||||
export async function fetchEntitiesApi(req, res) {
|
||||
const entities = await fetchEntities(req.query);
|
||||
|
||||
res.send(entities);
|
||||
}
|
||||
|
||||
export const entitiesSchema = `
|
||||
extend type Query {
|
||||
entities(
|
||||
query: String
|
||||
limit: Int! = 30
|
||||
page: Int! = 1
|
||||
): EntitiesResult
|
||||
|
||||
entity(
|
||||
id: Int!
|
||||
): Entity
|
||||
}
|
||||
|
||||
type EntitiesResult {
|
||||
nodes: [Entity]
|
||||
total: Int
|
||||
}
|
||||
|
||||
type Entity {
|
||||
id: Int!
|
||||
name: String
|
||||
slug: String
|
||||
parent: Entity
|
||||
}
|
||||
`;
|
||||
|
||||
export async function fetchEntitiesGraphql(query, _req) {
|
||||
const entities = await fetchEntities(query);
|
||||
|
||||
return {
|
||||
nodes: entities,
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchEntitiesByIdGraphql(query, _req) {
|
||||
const [entity] = await fetchEntitiesById([query.id]);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -4,18 +4,29 @@ import {
|
||||
GraphQLScalarType,
|
||||
} from 'graphql';
|
||||
|
||||
import { scenesSchema, fetchScenesGraphql } from './scenes.js';
|
||||
import {
|
||||
scenesSchema,
|
||||
fetchScenesGraphql,
|
||||
fetchScenesByIdGraphql,
|
||||
} from './scenes.js';
|
||||
|
||||
import {
|
||||
entitiesSchema,
|
||||
fetchEntitiesGraphql,
|
||||
fetchEntitiesByIdGraphql,
|
||||
} from './entities.js';
|
||||
|
||||
const schema = buildSchema(`
|
||||
type Query {
|
||||
scenes(
|
||||
movies(
|
||||
limit: Int = 30
|
||||
): Result
|
||||
): ReleasesResult
|
||||
}
|
||||
|
||||
scalar Date
|
||||
|
||||
${scenesSchema}
|
||||
${entitiesSchema}
|
||||
`);
|
||||
|
||||
const DateTimeScalar = new GraphQLScalarType({
|
||||
@@ -39,6 +50,9 @@ export async function graphqlApi(req, res) {
|
||||
},
|
||||
rootValue: {
|
||||
scenes: async (query) => fetchScenesGraphql(query, req),
|
||||
scene: async (query) => fetchScenesByIdGraphql(query, req),
|
||||
entities: async (query) => fetchEntitiesGraphql(query, req),
|
||||
entity: async (query) => fetchEntitiesByIdGraphql(query, req),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { stringify } from '@brillout/json-serializer/stringify'; /* eslint-disable-line import/extensions */
|
||||
|
||||
import { fetchScenes } from '../scenes.js';
|
||||
import { fetchScenes, fetchScenesById } from '../scenes.js';
|
||||
import { parseActorIdentifier } from '../query.js';
|
||||
import { getIdsBySlug } from '../cache.js';
|
||||
import slugify from '../../utils/slugify.js';
|
||||
@@ -21,8 +21,8 @@ export async function curateScenesQuery(query) {
|
||||
} = await promiseProps({
|
||||
tagIds: getIdsBySlug([query.tagSlug, ...splitTags.filter((tag) => tag.charAt(0) !== '!')], 'tags'),
|
||||
notTagIds: getIdsBySlug([...(query.tagFilter || []), ...(splitTags.filter((tag) => tag.charAt(0) === '!').map((tag) => tag.slice(1)) || [])].map((tag) => slugify(tag)), 'tags'),
|
||||
entityId: mainEntity ? await getIdsBySlug([mainEntity], 'entities').then(([id]) => id) : query.entityId,
|
||||
notEntityIds: await getIdsBySlug(splitEntities.filter((entity) => entity.charAt(0) === '!').map((entity) => entity.slice(1)), 'entities'),
|
||||
entityId: mainEntity ? getIdsBySlug([mainEntity], 'entities').then(([id]) => id) : query.entityId,
|
||||
notEntityIds: getIdsBySlug(splitEntities.filter((entity) => entity.charAt(0) === '!').map((entity) => entity.slice(1)), 'entities'),
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -71,27 +71,48 @@ export async function fetchScenesApi(req, res) {
|
||||
}
|
||||
|
||||
export const scenesSchema = `
|
||||
type Aggregate {
|
||||
extend type Query {
|
||||
scenes(
|
||||
query: String
|
||||
scope: String
|
||||
entities: [String]
|
||||
actorIds: [String]
|
||||
tags: [String]
|
||||
limit: Int! = 30
|
||||
page: Int! = 1
|
||||
): ReleasesResult
|
||||
|
||||
scene(
|
||||
id: Int!
|
||||
): Release
|
||||
}
|
||||
|
||||
type ReleasesAggregate {
|
||||
actors: [Actor]
|
||||
}
|
||||
|
||||
type Result {
|
||||
nodes: [Scene]
|
||||
aggregates: Aggregate
|
||||
type ReleasesResult {
|
||||
nodes: [Release]
|
||||
total: Int
|
||||
aggregates: ReleasesAggregate
|
||||
}
|
||||
|
||||
type Scene {
|
||||
type Release {
|
||||
id: Int!
|
||||
title: String
|
||||
effectiveDate: Date
|
||||
date: Date
|
||||
createdAt: Date
|
||||
shootId: Int
|
||||
channel: Entity
|
||||
network: Entity
|
||||
actors: [Actor]
|
||||
tags: [Tag]
|
||||
poster: Media
|
||||
trailer: Media
|
||||
photos: [Media]
|
||||
covers: [Media]
|
||||
movies: [Release]
|
||||
}
|
||||
|
||||
type Actor {
|
||||
@@ -100,11 +121,11 @@ export const scenesSchema = `
|
||||
slug: String
|
||||
}
|
||||
|
||||
type Entity {
|
||||
type Tag {
|
||||
id: Int!
|
||||
name: String
|
||||
slug: String
|
||||
parent: Entity
|
||||
priority: Int
|
||||
}
|
||||
|
||||
type Media {
|
||||
@@ -123,28 +144,58 @@ export const scenesSchema = `
|
||||
`;
|
||||
|
||||
export async function fetchScenesGraphql(query, req) {
|
||||
const mainEntity = query.entities?.find((entity) => entity.charAt(0) !== '!');
|
||||
|
||||
const {
|
||||
tagIds,
|
||||
notTagIds,
|
||||
entityId,
|
||||
notEntityIds,
|
||||
} = await promiseProps({
|
||||
tagIds: getIdsBySlug(query.tags?.filter((tag) => tag.charAt(0) !== '!'), 'tags'),
|
||||
notTagIds: getIdsBySlug(query.tags?.filter((tag) => tag.charAt(0) === '!').map((tag) => tag.slice(1)).map((tag) => slugify(tag)), 'tags'),
|
||||
entityId: getIdsBySlug([mainEntity], 'entities').then(([id]) => id),
|
||||
notEntityIds: getIdsBySlug(query.entities?.filter((entity) => entity.charAt(0) === '!').map((entity) => entity.slice(1)), 'entities'),
|
||||
});
|
||||
|
||||
const {
|
||||
scenes,
|
||||
aggActors,
|
||||
total,
|
||||
/*
|
||||
aggActors,
|
||||
aggTags,
|
||||
aggChannels,
|
||||
limit,
|
||||
total,
|
||||
*/
|
||||
} = await fetchScenes({}, {
|
||||
} = await fetchScenes({
|
||||
query: query.query, // query query query query
|
||||
tagIds,
|
||||
notTagIds,
|
||||
entityId,
|
||||
notEntityIds,
|
||||
actorIds: query.actorIds?.filter((actorId) => actorId.charAt(0) !== '!').map((actorId) => Number(actorId)),
|
||||
notActorIds: query.actorIds?.filter((actorId) => actorId.charAt(0) === '!').map((actorId) => Number(actorId.slice(1))),
|
||||
scope: query.query && !query.scope
|
||||
? 'results'
|
||||
: query.scope,
|
||||
isShowcased: null,
|
||||
}, {
|
||||
page: query.page || 1,
|
||||
limit: query.limit || 30,
|
||||
aggregate: false,
|
||||
}, req.user);
|
||||
|
||||
// console.log('agg actors', aggActors);
|
||||
console.log('query', query);
|
||||
console.log(query);
|
||||
|
||||
return {
|
||||
nodes: scenes,
|
||||
total,
|
||||
/* restrict until deemed essential for 3rd party apps
|
||||
aggregates: {
|
||||
actors: aggActors,
|
||||
tags: aggTags,
|
||||
channels: aggChannels,
|
||||
},
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -158,3 +209,12 @@ export async function fetchScenesGraphql(query, req) {
|
||||
};
|
||||
*/
|
||||
}
|
||||
|
||||
export async function fetchScenesByIdGraphql(query, req) {
|
||||
const [scene] = await fetchScenesById([query.id], {
|
||||
reqUser: req.user,
|
||||
includePartOf: true,
|
||||
});
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user