🎨 Format static use case

This commit is contained in:
Maxim Lebedev 2024-01-22 08:06:56 +06:00
parent ed87027846
commit 5adcb66862
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
2 changed files with 5 additions and 4 deletions

View File

@ -7,5 +7,6 @@ import (
)
type UseCase interface {
// Do search static on path and returns Static domain if exist.
Do(ctx context.Context, path string) (*domain.Static, error)
}

View File

@ -11,19 +11,19 @@ import (
)
type staticUseCase struct {
statics static.Repository
store static.Repository
}
func NewStaticUseCase(statics static.Repository) static.UseCase {
func NewStaticUseCase(store static.Repository) static.UseCase {
return &staticUseCase{
statics: statics,
store: store,
}
}
func (ucase *staticUseCase) Do(ctx context.Context, p string) (*domain.Static, error) {
p = strings.TrimPrefix(path.Clean(p), "/")
s, err := ucase.statics.Get(ctx, p)
s, err := ucase.store.Get(ctx, p)
if err != nil {
return nil, fmt.Errorf("cannot get static file: %w", err)
}