thekid / dialog

Dialog photoblog
2 stars 1 forks source link

Refactor codebase to use a repository... #6

Closed thekid closed 1 year ago

thekid commented 1 year ago

...instead of directly querying the database. The repository is still quite MongoDB-centric, but it's not meant to be replaced with another implementation anytime soon, rather serve as something like a "named queries" container.

public class de.thekid.dialog.Repository {
  public function __construct(com.mongodb.Database $database)

  public function authenticate(string $user, util.Secret $secret): ?com.mongodb.Document
  public function entries(de.thekid.dialog.Pagination $pagination, int $page): iterable
  public function entry(string $slug): ?com.mongodb.Document
  public function children(string $slug): iterable
  public function replace(string $slug, array $entity): com.mongodb.result.Update
  public function modify(string $slug, array $statements): com.mongodb.result.Update
}