Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,57 @@
import { Decimal } from "decimal.js";
export type FormulaDto = {
id?: string;
name: string;
description: string | null;
components: FormulaComponentDto[];
resultAs?: FormulaResultAsType;
calculationTrigger?: FormulaCalculationTriggerType;
withLogs?: boolean;
createdAt?: Date;
inProperties?: { id: string; name: string; entity: { id: string; name: string } }[];
};
export const FormulaCalculationTriggerTypes = ["ALWAYS", "NEVER", "BEFORE_LISTED", "AFTER_CREATED", "BEFORE_VIEWED", "AFTER_UPDATED", "IF_UNSET"] as const;
export type FormulaCalculationTriggerType = (typeof FormulaCalculationTriggerTypes)[number];
export const FormulaResultAsTypes = ["number", "boolean", "string", "date"] as const;
export type FormulaResultAsType = (typeof FormulaResultAsTypes)[number];
export const FormulaOperatorTypes = [
"ADD",
"SUBTRACT",
"MULTIPLY",
"DIVIDE",
"CONCAT",
"EQUALS",
"NOT_EQUALS",
"GREATER_THAN",
"LESS_THAN",
"GREATER_THAN_OR_EQUAL",
"LESS_THAN_OR_EQUAL",
"AND",
"OR",
"NOT",
"DATE_ADD_DAYS",
] as const;
export type FormulaOperatorType = (typeof FormulaOperatorTypes)[number];
export type FormulaParenthesisType = "OPEN" | "CLOSE";
type RowMedia = {};
type RowValueMultiple = { order: number; value: string };
type RowValueRange = { numberMin: Decimal | null; numberMax: Decimal | null; dateMin: Date | null; dateMax: Date | null };
export type FormulaValueType = string | number | boolean | RowMedia[] | RowValueMultiple[] | RowValueRange | Date | null;
export type FormulaEndResult = string | number | boolean | Date | null;
export const FormulaComponentTypes = [
{ value: "variable", name: "Variable" },
{ value: "operator", name: "Operator" },
{ value: "parenthesis", name: "Parenthesis" },
{ value: "value", name: "Value" },
] as const;
export type FormulaComponentType = (typeof FormulaComponentTypes)[number]["value"];
export type FormulaComponentDto = {
order: number;
type: FormulaComponentType;
value: string;
};
@@ -0,0 +1,20 @@
import { EntityWithDetails } from "~/utils/db/entities/entities.db.server";
import { RowWithDetails } from "~/utils/db/entities/rows.db.server";
import { TenantWithDetails } from "~/utils/db/tenants.db.server";
import { UserWithDetails } from "~/utils/db/users.db.server";
export type FormulaVariableValueDto = {
plain?: {
variable: string;
textValue?: string | undefined;
numberValue?: number | undefined;
dateValue?: Date | undefined;
booleanValue?: boolean | undefined;
};
row?: {
entity: EntityWithDetails;
item: RowWithDetails;
};
tenant?: TenantWithDetails;
user?: UserWithDetails;
};