diff --git a/db/db.ts b/db/db.ts index 552a41c796..956c636348 100644 --- a/db/db.ts +++ b/db/db.ts @@ -544,18 +544,23 @@ export async function getFlatTagGraph(knex: KnexReadonlyTransaction): Promise< // Use this with getUniqueNamesFromParentTagArrays to get Record instead export async function getParentTagArraysByChildName( trx: KnexReadonlyTransaction -): Promise> { +): Promise< + Record[][]> +> { const { __rootId, ...flatTagGraph } = await getFlatTagGraph(trx) const tagGraph = createTagGraph(flatTagGraph, __rootId) - const tagsById = await trx("tags") + const tagsById = await trx("tags") .select("id", "name", "slug") .then((tags) => keyBy(tags, "id")) - const pathsByChildName: Record = {} + const pathsByChildName: Record< + DbPlainTag["name"], + Pick[][] + > = {} function trackAllPaths( node: TagGraphNode, - currentPath: DbPlainTag[] = [] + currentPath: Pick[] = [] ): void { const currentTag = tagsById[node.id] const newPath = [...currentPath, currentTag]