Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

fix(demo): proper computation of tag documents count (#885)

Corentin Thomassetb766d1ec1a5f
diff --git a/apps/papra-client/src/modules/demo/demo-api-mock.ts b/apps/papra-client/src/modules/demo/demo-api-mock.ts
index 1ef14109..e402e1b2 100644
--- a/apps/papra-client/src/modules/demo/demo-api-mock.ts
+++ b/apps/papra-client/src/modules/demo/demo-api-mock.ts
@@ -332,11 +332,11 @@ const inMemoryApiMock: Record<string, { handler: any }> = {
assert(organization, { status: 403 });
const tags = await findMany(tagStorage, tag => tag.organizationId === organizationId);
- const documents = await findMany(documentStorage, document => document.organizationId === organizationId);
+ const tagDocuments = await getValues(tagDocumentStorage);
const tagsWithDocumentsCount = tags.map(tag => ({
...tag,
- documentsCount: documents.filter(document => document.tags.some(t => t.id === tag.id)).length,
+ documentsCount: tagDocuments.filter(tagDocument => tagDocument.tagId === tag.id).length,
}));
return {