mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
add migration file when the app is starting
This commit is contained in:
@@ -14,6 +14,7 @@ import type {
|
||||
} from "@/types/rule-engine";
|
||||
|
||||
const CARGO_TYPE_PARENT_PAGE_SIZE = 500;
|
||||
const CONTAINER_TYPE_OPTIONS_PAGE_SIZE = 500;
|
||||
|
||||
export const useRuleEngineList = (
|
||||
resource: RuleEngineResourceSlug,
|
||||
@@ -52,6 +53,36 @@ export const useCargoTypeParentOptions = (excludeId?: string, enabled = true) =>
|
||||
},
|
||||
});
|
||||
|
||||
export const useContainerTypeOptions = (enabled = true) =>
|
||||
useQuery({
|
||||
queryKey: [
|
||||
...QUERY_KEYS.RULE_ENGINE.list("container-types"),
|
||||
"select-options",
|
||||
],
|
||||
queryFn: () =>
|
||||
ruleEngineService.list<RuleEngineRecord>("container-types", {
|
||||
page: 1,
|
||||
pageSize: CONTAINER_TYPE_OPTIONS_PAGE_SIZE,
|
||||
}),
|
||||
enabled,
|
||||
select: (result) => {
|
||||
const noneOption = { label: "None", value: RULE_ENGINE_SELECT_NONE };
|
||||
const options = (result.data ?? []).map((row) => {
|
||||
const label = String(row.label ?? "").trim();
|
||||
const code = String(row.code ?? "").trim();
|
||||
const size = row.sizeFt ? `${String(row.sizeFt)}ft` : "";
|
||||
const parts = [label || code || String(row.id), size].filter(Boolean);
|
||||
|
||||
return {
|
||||
label: parts.join(" - "),
|
||||
value: String(row.id),
|
||||
};
|
||||
});
|
||||
|
||||
return [noneOption, ...options];
|
||||
},
|
||||
});
|
||||
|
||||
export const useApprovalChain = (enabled: boolean) =>
|
||||
useQuery({
|
||||
queryKey: QUERY_KEYS.RULE_ENGINE.chain,
|
||||
|
||||
Reference in New Issue
Block a user