Add series
If a book is in a series, it should be possible to see:
- Its position in the series
- The name of the series (e.g. 'Harry Potter' for the Harry Potter books)
- Other books in the same series
Hi @knjk04 . Is it still open? I wanna work on this issue...
Hi, @Sajal193 . Yes, it is. Before I assign you to the issue, what's your implementation approach?
Hello, I would like to take a shot at this.
My proposal:
- Create an Entity
BookSerieswith propertiesSeries Id (Key), Name of Series, Series Order Number, Book Id (Foreign Key) - Modify Entity
Bookto add propertySeries Id (Foreign Key)
Does that make sense ?
Hello, thanks for your interest in this!
Create an Entity BookSeries with properties Series Id (Key), Name of Series, Series Order Number, Book Id (Foreign Key)
The Id ad name of the series sounds good.
Perhaps we don't need a series order number if a BookSeries contains an ordered (and unique) collection of books? Your approach sounds good, but how could we prevent different books from having the same series position?
I see an issue with my proposed approach where a Unique Series Id will relate to a single Book Id (When we need it to relate with multiple book id's).
Maybe we can:
- Create a
BookSeriesentity with propertiesBookSeriesId (Key),SeriesName - Create a
BookSeriesMappingentity with propertiesBookSeriesId (FK),BookId (FK),SerialNumber. - Skip any changes to
Bookentity.
As to have a unique SerialNumber for every BookSeriesId & BookId, I'm not sure if a UNIQUE constraint would work here. Any ideas ?
I confirmed that A UNIQUE(BookSeriesId, BookId, SerialNumber) constraint should work.
Does the serial number represent the order a book is in a series?
Create a BookSeriesMapping entity with properties BookSeriesId (FK),BookId (FK),SerialNumber.
So there would be a many-to-many relationship between Book and BookSeries. Is that correct?
Skip any changes to Book entity.
Sorry, what do you mean by 'skip' here?
Does the serial number represent the order a book is in a series?
Create a BookSeriesMapping entity with properties BookSeriesId (FK),BookId (FK),SerialNumber.
So there would be a many-to-many relationship between
BookandBookSeries. Is that correct?Skip any changes to Book entity.
Sorry, what do you mean by 'skip' here?
- Yes serial number represents order of book in series.
- Yes, there will be a many to many relationship between the two.
- By skip, I meant I wont make any changes to
Bookentity.
@kev711 Thanks! Feel free to reach out by creating a GitHub discussion or by asking on our #help channel on Slack if you need anything!
@kev711 I think a book should be in at most one series and a series can contain many books. Should the relationship between series and book be many-to-one?
Also, we're now using Gradle & DGS, so I'd recommend rebasing your branch with main to get the new commits if you haven't already
I think in future, if the need arises to have a book in multiple series (e.g. Author specials, author etc.) then that would be needed.
@kev711 How are you getting on with this?
Still working on this. Not stuck as such, will create a PR on this in a few days.
That's fine, thanks for the update!
About this requirement, should these repository functions be a part of Entity Book or BookSeriesMapping ?
If a book is in a series, it should be possible to see:
- Its position in the series
- The name of the series (e.g. 'Harry Potter' for the Harry Potter books)
- Other books in the same series
Good question! I think it should be a part of the Book entity
@knjk04 I have created a PR for this.