feat(master-data): add jurisdiction and rule category entities with CRUD operations

- Introduced Jurisdiction and RuleCategory entities along with their respective values.
- Implemented service methods for managing rule categories and values.
- Updated MasterDataService to include seeding logic for jurisdictions and rule categories.
- Added DTOs for creating and updating rule categories and values.

feat(policy-engine): enhance policy management with new entities and operations

- Created Policy, PolicyRule, PolicyAction, PolicyTargetAudience, and RuleCondition entities.
- Implemented create, update, and delete operations for policies and their associated rules and actions.
- Added enums for PolicyStatus and AudienceType to manage policy states and target audiences.
- Developed DTOs for creating and updating policies with nested structures for rules and audiences.
This commit is contained in:
Syed Waseem
2026-07-21 11:22:54 +05:30
parent 4fd1058dfe
commit f3acfd2181
29 changed files with 1563 additions and 15 deletions
+41
View File
@@ -146,6 +146,47 @@ CREATE TABLE IF NOT EXISTS masters.tbl_revenue_segments (
);
CREATE INDEX IF NOT EXISTS idx_tbl_revenue_segments_tenant ON masters.tbl_revenue_segments("tenantId");
CREATE TABLE IF NOT EXISTS masters.tbl_rules_categories (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
"tenantId" UUID NOT NULL REFERENCES tenant.tbl_tenants(id) ON DELETE CASCADE,
code VARCHAR(100) UNIQUE NOT NULL,
name VARCHAR(150) NOT NULL,
description TEXT,
"displayOrder" INT DEFAULT 0,
"isActive" BOOLEAN DEFAULT TRUE,
"createdAt" TIMESTAMP NOT NULL DEFAULT now(),
"updatedAt" TIMESTAMP NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_tbl_rules_categories_tenant ON masters.tbl_rules_categories("tenantId");
CREATE TABLE IF NOT EXISTS masters.tbl_rule_categories_values (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
"tenantId" UUID NOT NULL REFERENCES tenant.tbl_tenants(id) ON DELETE CASCADE,
"categoryId" UUID NOT NULL REFERENCES masters.tbl_rules_categories(id) ON DELETE CASCADE,
code VARCHAR(100),
value VARCHAR(255) NOT NULL,
"displayOrder" INT DEFAULT 0,
"isActive" BOOLEAN DEFAULT TRUE,
"createdAt" TIMESTAMP NOT NULL DEFAULT now(),
"updatedAt" TIMESTAMP NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_tbl_rule_categories_values_tenant ON masters.tbl_rule_categories_values("tenantId");
CREATE INDEX IF NOT EXISTS idx_tbl_rule_categories_values_category ON masters.tbl_rule_categories_values("categoryId");
CREATE TABLE IF NOT EXISTS masters.tbl_operators (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
"tenantId" UUID NOT NULL REFERENCES tenant.tbl_tenants(id) ON DELETE CASCADE,
code VARCHAR(50) UNIQUE NOT NULL,
name VARCHAR(100) NOT NULL,
symbol VARCHAR(20),
"dataTypes" TEXT[],
"isActive" BOOLEAN DEFAULT TRUE,
"displayOrder" INT DEFAULT 0,
"createdAt" TIMESTAMP NOT NULL DEFAULT now(),
"updatedAt" TIMESTAMP NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_tbl_operators_tenant ON masters.tbl_operators("tenantId");
-- ─── Cohorts ────────────────────────────────────────────────────────────────
CREATE TABLE IF NOT EXISTS cohort.tbl_cohorts (