fix
This commit is contained in:
parent
305074648d
commit
a115976802
|
|
@ -49,6 +49,8 @@ type TableListProp = {
|
|||
render_row?: (child: any, data: any) => ReactNode;
|
||||
rowHeight?: number;
|
||||
render_col?: (props: any) => ReactNode;
|
||||
soft_delete_field: string;
|
||||
|
||||
};
|
||||
const w = window as any;
|
||||
const selectCellClassname = css`
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ export const on_load = ({
|
|||
reload: () => Promise<void>;
|
||||
orderBy?: Record<string, "asc" | "desc">;
|
||||
paging: { take: number; skip: number };
|
||||
mode: 'count' | 'query'
|
||||
mode: 'count' | 'query';
|
||||
where?: any
|
||||
}
|
||||
`;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -114,3 +114,4 @@ export { getPathname } from "./utils/pathname";
|
|||
|
||||
export * from "@/comps/ui/typeahead";
|
||||
export * from "@/comps/ui/input";
|
||||
export {softDeleteFilter} from "@/utils/soft-delete-filter"
|
||||
|
|
@ -50,7 +50,8 @@ type TableOnLoad = {
|
|||
reload: () => Promise<void>;
|
||||
orderBy?: Record<string, "asc" | "desc">;
|
||||
paging: { take: number; skip: number };
|
||||
mode: 'count' | 'query'
|
||||
mode: 'count' | 'query';
|
||||
where?: any
|
||||
}
|
||||
`;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
export const softDeleteFilter = (
|
||||
where: any,
|
||||
soft: {
|
||||
field: string;
|
||||
type: "boolean" | "nullable";
|
||||
}
|
||||
) => {
|
||||
console.log({where})
|
||||
const defaultParam = typeof where === "object" ? where : {}
|
||||
const result = {
|
||||
AND: [
|
||||
typeof where === "object" ? { ...defaultParam },
|
||||
{
|
||||
[soft.field]:
|
||||
soft.type === "boolean"
|
||||
? true
|
||||
: {
|
||||
not: null,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
console.log(result)
|
||||
return result;
|
||||
};
|
||||
Loading…
Reference in New Issue