👔 Created basic theme use case implementation

This commit is contained in:
Maxim Lebedev 2023-11-08 08:53:32 +06:00
parent c3245c3588
commit e71a84bb07
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 28 additions and 0 deletions

View File

@ -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
}