👔 Created basic theme use case implementation
This commit is contained in:
parent
c3245c3588
commit
e71a84bb07
|
@ -0,0 +1,28 @@
|
|||
package usecase
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"html/template"
|
||||
|
||||
"source.toby3d.me/toby3d/home/internal/theme"
|
||||
)
|
||||
|
||||
type themeUseCase struct {
|
||||
themes theme.Repository
|
||||
}
|
||||
|
||||
func NewThemeUseCase(themes theme.Repository) theme.UseCase {
|
||||
return &themeUseCase{
|
||||
themes: themes,
|
||||
}
|
||||
}
|
||||
|
||||
func (ucase *themeUseCase) Do(ctx context.Context) (*template.Template, error) {
|
||||
out, err := ucase.themes.Get(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot find theme: %w", err)
|
||||
}
|
||||
|
||||
return out.Lookup("baseof"), nil
|
||||
}
|
Loading…
Reference in New Issue