Skip to main content

Overview

The Libro interface represents a book in the virtual library system. It includes book metadata and relationships to authors and genres.

Interface Definition

Properties

Basic Properties

number
required
Unique identifier for the book. Auto-generated by the backend.
string
required
The book’s title.
string
Optional URL or path to the book’s cover image.
number
Optional publication year of the book.
boolean
required
Indicates whether the book is currently available for loan. true if available, false if currently loaned out.

Relationships

Genero
required
The genre/category to which this book belongs. See Genero interface.
Autor[]
required
Array of authors who wrote this book. A book can have multiple authors. See Autor interface.

Usage Examples

Fetching All Books

Creating a New Book

Updating a Book

Deleting a Book

Filtering Available Books

  • Autor - Book author interface
  • Genero - Book genre interface
  • Prestamo - Loan interface that references Libro

Notes

The disponible field is automatically updated by the backend when a loan is approved or a book is returned.
When creating or updating a book, ensure the genero and autores objects contain valid IDs that exist in the database.