ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
book_service Class Reference

Service for managing books. More...

#include <book_service.hpp>

Collaboration diagram for book_service:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

 book_service (context ctx)
 Constructs a book_service with required repositories.
 
std::vector< domain::booklist_books ()
 Lists all books.
 
std::optional< domain::bookfind_book (const boost::uuids::uuid &id)
 Finds a book by its ID.
 
std::optional< domain::bookfind_book_by_code (const std::string &code)
 Finds a book by its code.
 
void save_book (const domain::book &book)
 Saves a book (creates or updates).
 
void save_books (const std::vector< domain::book > &books)
 Saves multiple books (creates or updates).
 
void remove_book (const boost::uuids::uuid &id)
 Removes a book.
 
std::vector< domain::bookget_book_history (const boost::uuids::uuid &id)
 Gets the version history for a book.
 

Detailed Description

Service for managing books.

This service provides functionality for:

Constructor & Destructor Documentation

◆ book_service()

book_service ( context  ctx)
explicit

Constructs a book_service with required repositories.

Parameters
ctxThe database context.

Member Function Documentation

◆ save_book()

void save_book ( const domain::book book)

Saves a book (creates or updates).

Parameters
bookThe book to save

◆ save_books()

void save_books ( const std::vector< domain::book > &  books)

Saves multiple books (creates or updates).

Parameters
booksThe books to save

◆ remove_book()

void remove_book ( const boost::uuids::uuid &  id)

Removes a book.

Parameters
idThe ID of the book to remove

◆ get_book_history()

std::vector< domain::book > get_book_history ( const boost::uuids::uuid &  id)

Gets the version history for a book.

Parameters
idThe book ID
Returns
Vector of all versions, newest first