mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2025-12-06 14:26:22 +00:00
Recursive crud fix
This commit is contained in:
parent
53a4e67f70
commit
35f23b6d9e
@ -406,10 +406,20 @@ func ShouldUseNestedProcessor(data map[string]interface{}, model interface{}, re
|
|||||||
relInfo := relationshipHelper.GetRelationshipInfo(modelType, key)
|
relInfo := relationshipHelper.GetRelationshipInfo(modelType, key)
|
||||||
if relInfo != nil {
|
if relInfo != nil {
|
||||||
// Check if the value is actually nested data (object or array)
|
// Check if the value is actually nested data (object or array)
|
||||||
switch value.(type) {
|
switch v := value.(type) {
|
||||||
case map[string]interface{}, []interface{}, []map[string]interface{}:
|
case map[string]interface{}:
|
||||||
logger.Debug("Found nested relation field: %s", key)
|
//logger.Debug("Found nested relation field: %s", key)
|
||||||
return true
|
return ShouldUseNestedProcessor(v, relInfo.RelatedModel, relationshipHelper)
|
||||||
|
case []interface{}, []map[string]interface{}:
|
||||||
|
//logger.Debug("Found nested relation field: %s", key)
|
||||||
|
for _, item := range v.([]interface{}) {
|
||||||
|
if itemMap, ok := item.(map[string]interface{}); ok {
|
||||||
|
if ShouldUseNestedProcessor(itemMap, relInfo.RelatedModel, relationshipHelper) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user