Skip to content

libcalibre: rewrite with simplified DDD #16

Description

@phildenhoff

I'd like to use a subset of DDD's language in libcalibre that should make it easier to extend & maintain. With a better understanding of how libcalibre works (now that I've written (part of) it) comes the ability to write a better version.

  • repos: how to write to the database. Entities that also have a table get a repo. Other operations are in the aggregates repo? I guess? Includes ways to store Book Files.
  • dtos: requests to create new / update existing entities and aggregates.
  • services: specifically for Book, Author, LibraryFile (any file within the lib. root)

Stretch goals

  • Remove Arc (Rc is a better choice, but not ref. counting is even better)
  • Remove Mutex
  • Make setup easier in citadel-rs – creating (and destroying) 3-4 repos & 3-4 services is wild and mostly annoying. It 100% doesn't not need to do that, it can store the services.
  • Remove mut self's for services. It seems unnecessary
  • Minimize .clone() calls
  • Prefer &str to String
  • Create struct/types for BookId & AuthorId with parse_from and to_i32 impls (book_${id} => id)
  • High perf versions of read functions, e.g. only return IDs or support windows/pagination
  • Filtering (search(phrase, fields: &str[]) or similar pattern)

Book

Book aggregate (? or "entity"?) allows for CRUD-ing ("managing")

  • title
  • authors associated to a Book (update_links which diffs, adds & removes)
  • which series this book belongs to (add if missing; replace otherwise)
  • series position
  • external identifiers
  • tags
  • publication date
  • language
  • publisher
  • HTML description
  • book cover image (replace by file @ path), and
  • different format files (e.g. .epub, .kepub, and .mobi).

as well as

find_by_id/1
find_by_author/1
list_all/0
create/1, which accepts a minimal DTO

Author

Author entity supports CRUD operations for

  • name
  • link
  • ...associated book? that seems like a mistake

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions