cleaned up usage windows

This commit is contained in:
johnyeo
2026-06-11 15:28:59 +01:00
parent e7fa94e428
commit db7088b4dd
152 changed files with 9203 additions and 2051 deletions

View File

@@ -0,0 +1,16 @@
import type { UsageWindowLimit } from "../../../models/cusProductModels/cusEntModels/usageWindowModels.js";
import type { UsageWindow } from "../../../models/cusProductModels/cusEntModels/usageWindowTable.js";
/**
* Whether a counter row and a resolved limit describe the same counter:
* same feature, same scope (null entity = customer scope).
*/
export const usageWindowMatchesLimit = ({
usageWindow,
limit,
}: {
usageWindow: UsageWindow;
limit: UsageWindowLimit;
}): boolean =>
usageWindow.feature_id === limit.feature_id &&
(usageWindow.internal_entity_id ?? null) === limit.internal_entity_id;