How did you integrate the book editing and deletion into your UI? Why did you choose the design you did?
I integrated the book editing and deletion features directly into the books table. Each row now includes an "Edit" button that allows users to modify book details and a "Delete" button to remove a book. I chose this design because it keeps all book-related actions in one place, making the UI intuitive and easy to navigate.
What parts (if any) did you struggle with when implementing edit/delete in the UI?
The biggest challenge was managing state correctly when editing a book. I initially had issues with keeping the input fields updated with the existing book details. Using React's state hooks helped resolve this, but it took some trial and error. The delete function was easier to implement, but I had to make sure that the table updated dynamically without requiring a full page reload.
How easy was it to refactor your existing UI to use Material UI? What pitfalls did you run into trying to use it?
Refactoring the UI to use Material UI was relatively straightforward, especially for buttons, tables, and form inputs. Material UI’s pre-built components made styling easier and more consistent. However, customizing some components to match my previous design was tricky. I had to learn how to use Material UI’s theming and styling overrides. Additionally, ensuring the responsiveness of certain elements required some additional CSS adjustments.
How difficult was it to add the editing endpoint and associated tests? Did your experience writing the POST endpoints make writing the editing endpoints smoother?
Adding the editing endpoint was fairly straightforward since it followed a similar structure to the POST endpoints. I reused the validation logic from the POST request to ensure that updates were properly validated before modifying the database. The biggest challenge was making sure the frontend and backend communicated properly, as I initially forgot to return the updated book object from the backend.
Testing was also easier this time around since I had already written similar tests for creating books. However, I had to add additional tests to check that invalid updates (e.g., missing fields, invalid author ID) were correctly handled.