chore: use interfaces for web related services

This commit is contained in:
Christoph Haas
2025-03-09 21:48:38 +01:00
parent 678b6c6456
commit 02ed7b19df
8 changed files with 214 additions and 87 deletions

View File

@@ -79,11 +79,16 @@ func ParseServiceError(err error) (int, models.Error) {
}
}
// region handler-interfaces
type Authenticator interface {
// LoggedIn checks if a user is logged in. If scopes are given, they are validated as well.
LoggedIn(scopes ...Scope) func(next http.Handler) http.Handler
}
type Validator interface {
// Struct validates the given struct.
Struct(s interface{}) error
}
// endregion handler-interfaces