GET: Fetch all the replies of a particular parent_comment_id
Refactor Comment model
Remove the replies[] property from Comment schema
The many-to-one relationship should be accessed via Reply as it is on the many-side
Helps to keep data-consistency, since if replies[] exists in Comment, we would have to manually-update this array to keep it consistent, potentially recipe for disaster and data-inconsistency
Upgrade our Frontend to be able to fetch real-data from the api-routes and display it correctly
Created a separate component to manage AddForm and ReplyForm
Created a separate component to manage CommentCard and ReplyCard
Make use of useSWR package to create a custom react-hook, ensuring easier data-fetching without vanilla useEffect
Being used in CommentCard upon fetching the list of replies of a particular comment
Testing Result
✅ api-routes working properly
✅ FE is now using real-data fetched from database
✅ FE design remains the same and data is displayed correctly
✅ Previously worked FE functionality, like opening ReplyForm, showing comment-thread, etc, are working as expected
Related issues:
Description
Create api-routes to work with Reply document:
Refactor Comment model
Upgrade our Frontend to be able to fetch real-data from the api-routes and display it correctly
Make use of useSWR package to create a custom react-hook, ensuring easier data-fetching without vanilla useEffect
Testing Result
✅ api-routes working properly ✅ FE is now using real-data fetched from database ✅ FE design remains the same and data is displayed correctly ✅ Previously worked FE functionality, like opening ReplyForm, showing comment-thread, etc, are working as expected