Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Somewhat related issue: #49
Problem
BookCategorywas unable to display all data using the standardfindbyIDAPI and the reason being is that there was no unique identifier in the table. Both columns,book_idandcategory_idare foreign keys from other tables.Fix
There is now a new column
bookcategory_id, which will be a unique identifier (id) for each of the many-to-many relationships between books and categories so now, as you can see in the picture,book_id: 1andbook_id: 2both belong incategory: 1and so on. Thebookcategory_idisn't something we will actually use in an endpoint but at least it displays all the values. Before it wasn't able to do that.In the end, I only created this API to be able to use inner join to query books and categories together. It's possible all of this could have been avoided by building a query on
bookitself but I think this may make it easier to tie in books, categories, and their respective relationships. This is also important to have if you want to see all relationships between books and categories.Also @linesbetween, I have a lot of commented out code which I may end up using for later APIs but I wanted to leave it in for now and clean it all up later.