Fixed Paginated Search

This commit is contained in:
2025-10-31 16:29:20 +01:00
parent 3bd4ac1f56
commit 75518897f1
2 changed files with 161 additions and 99 deletions

View File

@@ -53,4 +53,20 @@ export async function findCustomerOrContactByEmailOrDomain(server:FastifyInstanc
}
return null
}
export function getNestedValue(obj: any, path: string): any {
return path.split('.').reduce((acc, part) => acc?.[part], obj);
}
export function compareValues(a: any, b: any): number {
if (a === b) return 0;
if (a == null) return 1;
if (b == null) return -1;
if (typeof a === 'string' && typeof b === 'string') {
return a.localeCompare(b);
}
return a < b ? -1 : 1;
}