fix filtering and sorting

This commit is contained in:
Casey 2025-11-12 07:01:26 -06:00
parent ba507f8e6a
commit 3b86ed0ee7
7 changed files with 334 additions and 201 deletions

View file

@ -1696,8 +1696,21 @@ class DataUtils {
];
static toSnakeCaseObject(obj) {
console.log("Converting to snake case:", obj);
const newObj = Object.entries(obj).reduce((acc, [key, value]) => {
const snakeKey = key.replace(/[A-Z]/g, (match) => "_" + match.toLowerCase());
if (key === "sorting") {
value = value
? value.map((item) => {
const [field, order] = item;
const snakeField = field.replace(
/[A-Z]/g,
(match) => "_" + match.toLowerCase(),
);
return [snakeField, order];
})
: value;
}
if (Array.isArray(value)) {
value = value.map((item) => {
return Object.prototype.toString.call(item) === "[object Object]"