subscription_validation
This commit is contained in:
@@ -3,6 +3,7 @@ package validation
|
||||
import (
|
||||
"GoMembership/internal/models"
|
||||
"GoMembership/internal/repositories"
|
||||
"GoMembership/pkg/logger"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
@@ -14,8 +15,8 @@ func ValidateSubscription(sl validator.StructLevel) {
|
||||
if subscription.Name == "" {
|
||||
sl.ReportError(subscription.Name, "Name", "name", "required", "")
|
||||
}
|
||||
|
||||
if sl.Parent().Type().Name() == "MembershipData" {
|
||||
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 == "" {
|
||||
sl.ReportError(subscription.Details, "Details", "details", "required", "")
|
||||
|
||||
Reference in New Issue
Block a user