Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcalibre: rewrite with simplified DDD #16

Open
15 tasks
phildenhoff opened this issue Jan 31, 2024 · 0 comments
Open
15 tasks

libcalibre: rewrite with simplified DDD #16

phildenhoff opened this issue Jan 31, 2024 · 0 comments

Comments

@phildenhoff
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant