Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job! 🎉 Your implementation meets all the stated requirements for the task. While overwriting the file with each new expense could be improved for a real-world application, the current approach is acceptable based on the given requirements. Keep up the good work, and consider enhancing the storage logic in future projects!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| const dbPath = path.join(__dirname, '../', './db/expense.json'); | ||
|
|
||
| fs.writeFileSync(dbPath, JSON.stringify(expense)); |
There was a problem hiding this comment.
Issue: Using fs.writeFileSync(dbPath, JSON.stringify(expense)); will overwrite the entire expense.json file with each new expense, so only the latest expense will be saved. If the task requires storing multiple expenses, you should read the existing data, append the new expense, and then write the updated array back to the file.
No description provided.