Moved logic from Handlers to UI Actions

This commit is contained in:
PB
2025-10-22 16:01:19 +02:00
parent 40a7d841b8
commit e546d16222
7 changed files with 121 additions and 25 deletions

View File

@@ -0,0 +1,29 @@
package ui
import (
dto "git.ego.freeddns.org/egommerce/api-entities/identity/dto"
"git.ego.freeddns.org/egommerce/identity-service/internal/service"
)
type RefreshTokenActionUI struct {
auth *service.AuthService
}
func NewRefreshTokenActionUI(auth *service.AuthService) *RefreshTokenActionUI {
return &RefreshTokenActionUI{
auth: auth,
}
}
func (ui *RefreshTokenActionUI) Execute(data *dto.AuthRefreshTokenRequestDTO) (string, error) {
token, err := ui.auth.RefreshToken(data.AccessToken)
if err != nil {
if err == service.ErrUnableToCacheToken { // FIXME: Move to RefreshHandlerFn
return "", err
}
return "", err
}
return token, nil
}