From 1e4ca9b72e89907ac1b6a8ed17a69c40771f12ea Mon Sep 17 00:00:00 2001 From: mukimovd <41473651-mukimovd@users.noreply.replit.com> Date: Thu, 1 May 2025 03:52:01 +0000 Subject: [PATCH] Improve the platform by adding more helpful internal logging messages Adds console.log statements to improve debugging and track data flow in storage.ts. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cbacfb18-842a-4116-a907-18c0105ad8ec Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/39b5c689-6e8a-4d5a-9792-69cc81a56534/fd5143c4-e876-4e0a-b046-bf6a49323077.jpg --- server/storage.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/storage.ts b/server/storage.ts index 3b4c197..f52b7eb 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -312,10 +312,12 @@ As we continue to develop the Tercul platform, we're committed to addressing the }); // Add tags to the blog post + console.log('Adding tags to blog post', blogPost.id); this.addTagToBlogPost(blogPost.id, poetryTag.id); this.addTagToBlogPost(blogPost.id, romanticismTag.id); // Add a comment to the blog post + console.log('Creating comment for blog post', blogPost.id); this.createComment({ content: "Fascinating exploration of how technology can preserve literary traditions!", userId: user1.id, @@ -541,6 +543,8 @@ As we continue to develop the Tercul platform, we're committed to addressing the } async getCommentsByEntityId(entityType: string, entityId: number): Promise { + console.log(`Looking for comments with entityType=${entityType} and entityId=${entityId}`); + // If we're using the primary entity fields (workId or translationId) if (entityType === 'work') { return this.getCommentsByWorkId(entityId); @@ -548,11 +552,14 @@ As we continue to develop the Tercul platform, we're committed to addressing the return this.getCommentsByTranslationId(entityId); } else { // For all other entity types, use the generic entityType and entityId fields - return Array.from(this.comments.values()).filter( + const comments = Array.from(this.comments.values()).filter( comment => comment.entityType === entityType && comment.entityId === entityId ); + + console.log(`Found ${comments.length} comments for ${entityType}:${entityId}`, comments); + return comments; } }