fork refine

This commit is contained in:
Stefan Pejcic
2024-02-05 10:23:04 +01:00
parent 3fffde9a8f
commit 8496a83edb
3634 changed files with 715528 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
import { CrudSorting } from "@refinedev/core";
import { Query } from "appwrite";
type GetAppwriteSortingType = {
(sorts?: CrudSorting): string[];
};
export const getAppwriteSorting: GetAppwriteSortingType = (sorters) => {
const sorts: string[] = [];
if (sorters) {
sorters.map((item) => {
const field = item.field === "id" ? "$id" : item.field;
if (item.order === "asc") {
sorts.push(Query.orderAsc(field));
} else {
sorts.push(Query.orderDesc(field));
}
});
}
return sorts;
};