Integrated channel filter, partially restored actor bio.
This commit is contained in:
@@ -4,8 +4,8 @@ import { fetchScenes } from '../scenes.js';
|
||||
import { parseActorIdentifier } from '../query.js';
|
||||
import redis from '../redis.js';
|
||||
|
||||
async function getTagIdsBySlug(tagSlugs) {
|
||||
const tagIds = await Promise.all(tagSlugs.map(async (slug) => {
|
||||
async function getIdsBySlug(slugs, domain) {
|
||||
const ids = await Promise.all(slugs.map(async (slug) => {
|
||||
if (!slug) {
|
||||
return null;
|
||||
}
|
||||
@@ -14,19 +14,20 @@ async function getTagIdsBySlug(tagSlugs) {
|
||||
return Number(slug); // already an ID or missing
|
||||
}
|
||||
|
||||
const tagId = await redis.hGet('traxxx:tags:id_by_slug', slug);
|
||||
const id = await redis.hGet(`traxxx:${domain}:id_by_slug`, slug);
|
||||
|
||||
return Number(tagId);
|
||||
return Number(id);
|
||||
}));
|
||||
|
||||
return tagIds.filter(Boolean);
|
||||
return ids.filter(Boolean);
|
||||
}
|
||||
|
||||
export async function curateScenesQuery(query) {
|
||||
return {
|
||||
scope: query.scope || 'latest',
|
||||
actorIds: [query.actorId, ...(query.actors?.split(',') || []).map((identifier) => parseActorIdentifier(identifier)?.id)].filter(Boolean),
|
||||
tagIds: await getTagIdsBySlug([query.tagId, ...(query.tags?.split(',') || [])]),
|
||||
tagIds: await getIdsBySlug([query.tagId, ...(query.tags?.split(',') || [])], 'tags'),
|
||||
entityId: query.e ? await getIdsBySlug([query.e], 'entities').then(([id]) => id) : query.entityId,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user