Refactor logic for interacting with repository
As a step towards refactoring the implementation of my Micropub service, we can start with how we interact with the stored files in the repository.
This simplifies all the places that we have Kind
-specific handling, as
it's starting to get a bit unmanageable, especially as we start to
introduce more kinds of content.
We can do this with a new PersistenceService
that can handle this
logic. In our case, we are tied to Hugo-specific setup, so have our
default implementation as HugoPersistenceService
.
Our PersistenceService
can also generate the slug
, if needed, rather
than the logic needing to be handled within the GitLabClient
.
This consolidates three key interactions:
- the creation/updating of posts in
GitLabClient
- the mapping of a URL to an in-repo path
- the creation/updating of posts in
StubMicropubPersistenceRepository
IntelliJ warns us that we should refactor duplication for sendPost
.
Closes #230 (closed).