From 024da3e546e98cbaeea5f7bc86af12b671996f41 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Thu, 29 Jun 2023 23:05:23 +0200 Subject: ref: Refactor how repository is define To make things easier and reduce the number of package I'll move all repository to one folder, starting with auth and user repository. Also implements all testing on top of the repository interface with a im memory implementation. This will later make mescling unit and integration easier. --- pkg/view/media.go | 2 +- pkg/view/settings.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'pkg/view') diff --git a/pkg/view/media.go b/pkg/view/media.go index 22f950d..66e3020 100644 --- a/pkg/view/media.go +++ b/pkg/view/media.go @@ -89,7 +89,7 @@ func (self *MediaView) GetImage(ctx *fasthttp.RequestCtx) error { } ctx.Response.Header.SetContentType(media.MIMEType) - ctx.SendFile(media.Path) + fasthttp.ServeFileUncompressed(ctx, media.Path) return nil } diff --git a/pkg/view/settings.go b/pkg/view/settings.go index e5acb1b..954cc98 100644 --- a/pkg/view/settings.go +++ b/pkg/view/settings.go @@ -5,7 +5,7 @@ import ( "git.sr.ht/~gabrielgio/img" "git.sr.ht/~gabrielgio/img/pkg/components/settings" - "git.sr.ht/~gabrielgio/img/pkg/components/user" + "git.sr.ht/~gabrielgio/img/pkg/database/repository" "git.sr.ht/~gabrielgio/img/pkg/ext" ) @@ -13,18 +13,18 @@ type ( SettingsView struct { // there is not need to create a controller for this settingsRepository settings.Repository - userRepository user.Repository + userRepository repository.UserRepository } SettingsPage struct { Settings *settings.Settings - Users []*user.User + Users []*repository.User } ) func NewSettingsView( settingsRespository settings.Repository, - userRepository user.Repository, + userRepository repository.UserRepository, ) *SettingsView { return &SettingsView{ settingsRepository: settingsRespository, -- cgit v1.2.3