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
This commit is contained in:
mukimovd 2025-05-01 03:52:01 +00:00
parent a6d53a2e93
commit 1e4ca9b72e

View File

@ -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<Comment[]> {
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;
}
}