mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
Merge pull request #14646 from ioito/hotfix/qx-join-filter
fix(common): pretty error msg for invalid joint filter
This commit is contained in:
@@ -214,6 +214,15 @@ func applyListItemsGeneralJointFilters(manager IModelManager, q *sqlchemy.SQuery
|
||||
if jointModelManager == nil {
|
||||
return nil, httperrors.NewResourceNotFoundError("invalid joint resources %s", jfc.GetJointModelName())
|
||||
}
|
||||
hasKey := false
|
||||
for _, colume := range manager.TableSpec().Columns() {
|
||||
if colume.Name() == jfc.OriginKey {
|
||||
hasKey = true
|
||||
}
|
||||
}
|
||||
if !hasKey {
|
||||
return q, httperrors.NewInputParameterError("invalid joint filter %s, because %s doesn't have %s field", f, manager.Keyword(), jfc.OriginKey)
|
||||
}
|
||||
schFields := searchFields(jointModelManager, userCred)
|
||||
if schFields.Contains(jfc.GetField()) {
|
||||
sq := jointModelManager.Query(jfc.RelatedKey)
|
||||
|
||||
Reference in New Issue
Block a user