This commit is contained in:
Alex
2025-04-10 15:40:22 +02:00
parent 87f08dd3be
commit 18f5dadb06
48 changed files with 1650 additions and 981 deletions

View File

@@ -3,19 +3,17 @@ package validation
import (
"GoMembership/internal/models"
"GoMembership/internal/repositories"
"GoMembership/pkg/logger"
"github.com/go-playground/validator/v10"
)
// ValidateNewSubscription validates a new subscription model being created
func ValidateSubscription(sl validator.StructLevel) {
subscription := sl.Current().Interface().(models.SubscriptionModel)
subscription := sl.Current().Interface().(models.Subscription)
if subscription.Name == "" {
sl.ReportError(subscription.Name, "Name", "name", "required", "")
}
logger.Error.Printf("parent.type.name: %#v", sl.Parent().Type().Name())
if sl.Parent().Type().Name() == "" {
// This is modifying a subscription directly
if subscription.Details == "" {