fix: move implementation to "internal" package
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 4m49s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 5m8s

This commit was merged in pull request #138.
This commit is contained in:
2025-05-29 13:23:13 +02:00
parent 9bb0cc475d
commit 6219741634
72 changed files with 245 additions and 230 deletions

View File

@@ -0,0 +1,25 @@
package service
import (
"fmt"
"regexp"
)
const (
DECIMALS_MULTIPLIER = 100
)
var (
safeInputRegex = regexp.MustCompile(`^[a-zA-Z0-9ÄÖÜäöüß,&'" -]+$`)
)
func validateString(value string, fieldName string) error {
switch {
case value == "":
return fmt.Errorf("field \"%s\" needs to be set: %w", fieldName, ErrBadRequest)
case !safeInputRegex.MatchString(value):
return fmt.Errorf("use only letters, dashes and spaces for \"%s\": %w", fieldName, ErrBadRequest)
default:
return nil
}
}