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