Skip to content

Implement book copies system #9

@NikosPoly

Description

@NikosPoly

Currently Book has a simple available boolean which doesn't reflect real world
library scenarios where multiple copies of the same book can exist.

Tasks

  • Add totalCopies and availableCopies integer fields to Book
    • totalCopies — total copies the library owns, only changes when library acquires or removes copies
    • availableCopies — how many copies are currently not on loan
  • Keep available boolean but sync it automatically from availableCopies > 0 in the service layer, never set manually
  • Update LoanService.createLoan() to decrement availableCopies on loan creation
  • Update LoanService return logic to increment availableCopies on book return
  • Block loan creation when availableCopies = 0

Note

Issue 3 and Issue 5 depend on this being implemented first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions