Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Add series #6

Open
knjk04 opened this issue Nov 21, 2020 · 17 comments
Open

Add series #6

knjk04 opened this issue Nov 21, 2020 · 17 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Issues to be worked on during the Hacktoberfest 2021 period

Comments

@knjk04
Copy link
Member

knjk04 commented Nov 21, 2020

If a book is in a series, it should be possible to see:

  1. Its position in the series
  2. The name of the series (e.g. 'Harry Potter' for the Harry Potter books)
  3. Other books in the same series
@knjk04 knjk04 added enhancement New feature or request good first issue Good for newcomers labels Nov 21, 2020
@Sajal193
Copy link

Hi @knjk04 . Is it still open? I wanna work on this issue...

@knjk04
Copy link
Member Author

knjk04 commented Jan 21, 2021

Hi, @Sajal193 . Yes, it is. Before I assign you to the issue, what's your implementation approach?

@kev711
Copy link

kev711 commented Feb 24, 2021

Hello, I would like to take a shot at this.

My proposal:

  • Create an Entity BookSeries with properties Series Id (Key), Name of Series, Series Order Number, Book Id (Foreign Key)
  • Modify Entity Book to add property Series Id (Foreign Key)

Does that make sense ?

@knjk04
Copy link
Member Author

knjk04 commented Feb 24, 2021

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?

@kev711
Copy link

kev711 commented Feb 25, 2021

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 BookSeries entity with properties BookSeriesId (Key),SeriesName
  • Create a BookSeriesMapping entity with properties BookSeriesId (FK),BookId (FK),SerialNumber.
  • Skip any changes to Book entity.

As to have a unique SerialNumber for every BookSeriesId & BookId, I'm not sure if a UNIQUE constraint would work here. Any ideas ?

@kev711
Copy link

kev711 commented Feb 26, 2021

I confirmed that A UNIQUE(BookSeriesId, BookId, SerialNumber) constraint should work.

@knjk04
Copy link
Member Author

knjk04 commented Feb 26, 2021

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?

@kev711
Copy link

kev711 commented Feb 26, 2021

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?

  • 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 Book entity.

@knjk04
Copy link
Member Author

knjk04 commented Feb 26, 2021

@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!

@knjk04
Copy link
Member Author

knjk04 commented Feb 28, 2021

@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

@kev711
Copy link

kev711 commented Feb 28, 2021

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.

@knjk04
Copy link
Member Author

knjk04 commented Mar 13, 2021

@kev711 How are you getting on with this?

@kev711
Copy link

kev711 commented Mar 14, 2021

Still working on this. Not stuck as such, will create a PR on this in a few days.

@knjk04
Copy link
Member Author

knjk04 commented Mar 14, 2021

That's fine, thanks for the update!

@kev711
Copy link

kev711 commented Mar 14, 2021

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:

  1. Its position in the series
  2. The name of the series (e.g. 'Harry Potter' for the Harry Potter books)
  3. Other books in the same series

@knjk04
Copy link
Member Author

knjk04 commented Mar 15, 2021

Good question! I think it should be a part of the Book entity

@kev711 kev711 mentioned this issue Mar 21, 2021
8 tasks
@kev711
Copy link

kev711 commented Mar 21, 2021

@knjk04
I have created a PR for this.

@kev711 kev711 mentioned this issue Apr 26, 2021
8 tasks
@knjk04 knjk04 self-assigned this Sep 15, 2021
@knjk04 knjk04 removed their assignment Sep 29, 2021
@knjk04 knjk04 added the hacktoberfest Issues to be worked on during the Hacktoberfest 2021 period label Sep 29, 2021
@knjk04 knjk04 added this to Books API Feb 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Issues to be worked on during the Hacktoberfest 2021 period
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants