From 7872296b838f4d1b26c6a0a01d79d27fe5ab44cc Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 15 Apr 2023 21:07:16 +0200 Subject: Move asset store into its own package --- src/http/assets.go | 8 ++++---- src/http/http.go | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/http') diff --git a/src/http/assets.go b/src/http/assets.go index 5b26a2e..1f5f0d6 100644 --- a/src/http/assets.go +++ b/src/http/assets.go @@ -16,7 +16,7 @@ import ( "time" "github.com/mediocregopher/blog.mediocregopher.com/srv/http/apiutil" - "github.com/mediocregopher/blog.mediocregopher.com/srv/post" + "github.com/mediocregopher/blog.mediocregopher.com/srv/post/asset" "github.com/omeid/go-tarfs" "golang.org/x/image/draw" ) @@ -170,7 +170,7 @@ func (a *api) handleGetPostAssetArchive( err := a.params.PostAssetStore.Get(info.id, buf) - if errors.Is(err, post.ErrAssetNotFound) { + if errors.Is(err, asset.ErrNotFound) { http.Error(rw, "asset not found", 404) return } else if err != nil { @@ -244,7 +244,7 @@ func (a *api) getPostAssetHandler() http.Handler { err := a.params.PostAssetStore.Get(id, buf) - if errors.Is(err, post.ErrAssetNotFound) { + if errors.Is(err, asset.ErrNotFound) { http.Error(rw, "Asset not found", 404) return } else if err != nil { @@ -297,7 +297,7 @@ func (a *api) deletePostAssetHandler() http.Handler { err := a.params.PostAssetStore.Delete(id) - if errors.Is(err, post.ErrAssetNotFound) { + if errors.Is(err, asset.ErrNotFound) { http.Error(rw, "Asset not found", 404) return } else if err != nil { diff --git a/src/http/http.go b/src/http/http.go index da404dc..dc2569a 100644 --- a/src/http/http.go +++ b/src/http/http.go @@ -20,6 +20,7 @@ import ( "github.com/mediocregopher/blog.mediocregopher.com/srv/http/apiutil" "github.com/mediocregopher/blog.mediocregopher.com/srv/mailinglist" "github.com/mediocregopher/blog.mediocregopher.com/srv/post" + "github.com/mediocregopher/blog.mediocregopher.com/srv/post/asset" "github.com/mediocregopher/blog.mediocregopher.com/srv/pow" "github.com/mediocregopher/mediocre-go-lib/v2/mctx" "github.com/mediocregopher/mediocre-go-lib/v2/mlog" @@ -36,7 +37,7 @@ type Params struct { Cache cache.Cache PostStore post.Store - PostAssetStore post.AssetStore + PostAssetStore asset.Store PostDraftStore post.DraftStore MailingList mailinglist.MailingList -- cgit v1.2.3