Matin17 / task_blog

0 stars 2 forks source link

Part 2: Architecture #2

Open Abdukhaligov opened 6 days ago

Abdukhaligov commented 6 days ago

Let's assume you want to introduce a feature that allows users to leave reviews for products. How would you architect this on the backend? Discuss database schema changes, API modifications, and frontend changes.

Abdukhaligov commented 6 days ago

Table: id, content, post_id -> reference to posts user_id -> reference to useres

Endpoints: GET - {post}/reviews - to get list of the reviews POST - {post}/reviews - to create a review, only content neede to sent, user_id and post_id will be filled from BE DELETE - {post}/reviews - check if it's current user review, then delete it

Frontend: Update show.blade.php to show the list of reviews Add form to show.blade.php for creating a post, with one Textarea field, Submit and Cancel buttons if user logged id