Compare commits

..

No commits in common. "fddbafc2d5fee37d15fd86979838fdbcd5647de9" and "89a729924d3e8a3e44a1ad16e866db960df1fe5d" have entirely different histories.

3 changed files with 14 additions and 7 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "traxxx", "name": "traxxx",
"version": "1.161.2", "version": "1.161.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "traxxx", "name": "traxxx",
"version": "1.161.2", "version": "1.161.1",
"description": "All the latest porn releases in one place", "description": "All the latest porn releases in one place",
"main": "src/app.js", "main": "src/app.js",
"scripts": { "scripts": {

View File

@ -133,6 +133,7 @@ async function fetchIncludedEntities() {
SELECT SELECT
parents.*, parents.*,
json_agg(included_entities ORDER BY included_entities.id) included_children, json_agg(included_entities ORDER BY included_entities.id) included_children,
row_to_json(grandparents) AS parent,
(SELECT json_agg(children) (SELECT json_agg(children)
FROM entities AS children FROM entities AS children
WHERE children.parent_id = parents.id) children WHERE children.parent_id = parents.id) children
@ -140,22 +141,26 @@ async function fetchIncludedEntities() {
included_entities included_entities
LEFT JOIN LEFT JOIN
entities AS parents ON parents.id = included_entities.parent_id entities AS parents ON parents.id = included_entities.parent_id
LEFT JOIN
entities AS grandparents ON grandparents.id = parents.parent_id
WHERE WHERE
included_entities.type = 'channel' included_entities.type = 'channel'
GROUP BY GROUP BY
parents.id parents.id, grandparents.id
), entity_tree as ( ), entity_tree as (
/* get recursive parents of networks (necessary for scraper resolve) */ /* get recursive parents of networks (necessary for scraper resolve) */
SELECT to_jsonb(included_per_network) as entity, SELECT to_jsonb(included_per_network) as entity,
parent_id, parent_id,
array['parent'] as parent_path array['parent'] as parent_path,
0 as depth
FROM included_per_network FROM included_per_network
UNION ALL UNION ALL
SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)), SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)),
entities.parent_id, entities.parent_id,
entity_tree.parent_path || array['parent'] entity_tree.parent_path || array['parent'],
depth + 1
FROM entity_tree FROM entity_tree
JOIN entities ON entity_tree.parent_id = entities.id JOIN entities ON entity_tree.parent_id = entities.id
) )
@ -180,7 +185,8 @@ async function fetchReleaseEntities(baseReleases) {
WITH RECURSIVE entity_tree as ( WITH RECURSIVE entity_tree as (
SELECT to_jsonb(entities) as entity, SELECT to_jsonb(entities) as entity,
parent_id, parent_id,
array['parent'] as parent_path array['parent'] as parent_path,
0 as depth
FROM entities FROM entities
WHERE slug = ANY(:entitySlugs) WHERE slug = ANY(:entitySlugs)
@ -188,7 +194,8 @@ async function fetchReleaseEntities(baseReleases) {
SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)), SELECT jsonb_set(entity_tree.entity, entity_tree.parent_path, to_jsonb(entities)),
entities.parent_id, entities.parent_id,
entity_tree.parent_path || array['parent'] entity_tree.parent_path || array['parent'],
depth + 1
FROM entity_tree FROM entity_tree
JOIN entities ON entity_tree.parent_id = entities.id JOIN entities ON entity_tree.parent_id = entities.id
) )