feat(restheadspec): Add support for join aliases in filters and sorts

- Extract join aliases from custom SQL JOIN clauses.
- Validate join aliases for filtering and sorting operations.
- Update documentation to reflect new functionality.
- Enhance tests for alias extraction and usage.
This commit is contained in:
Hein
2026-01-15 14:18:25 +02:00
parent b87841a51c
commit 24a7ef7284
5 changed files with 242 additions and 0 deletions

View File

@@ -166,6 +166,14 @@ func SanitizeWhereClause(where string, tableName string, options ...*RequestOpti
logger.Debug("Added preload relation '%s' as allowed table prefix", options[0].Preload[pi].Relation)
}
}
// Add join aliases as allowed prefixes
for _, alias := range options[0].JoinAliases {
if alias != "" {
allowedPrefixes[alias] = true
logger.Debug("Added join alias '%s' as allowed table prefix", alias)
}
}
}
// Split by AND to handle multiple conditions