@valentine-efagene/qshelter-common 2.0.124 → 2.0.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,13 +45,19 @@ export type StepCondition = SimpleCondition | CompoundCondition;
45
45
  *
46
46
  * // Score 80 if income >= 2000000
47
47
  * { operator: ConditionOperator.GREATER_THAN_OR_EQUAL, value: 2000000, score: 80 }
48
+ *
49
+ * // Score 10 if married is true
50
+ * { operator: ConditionOperator.EQUALS, value: true, score: 10 }
51
+ *
52
+ * // Score 100 if employment_status is "employed"
53
+ * { operator: ConditionOperator.EQUALS, value: "employed", score: 100 }
48
54
  * ```
49
55
  */
50
56
  export interface ScoringRule {
51
57
  /** The comparison operator for the condition */
52
58
  operator: ConditionOperator;
53
- /** The value to compare against */
54
- value: number;
59
+ /** The value to compare against (number for numeric comparisons, boolean/string for EQUALS/NOT_EQUALS) */
60
+ value: number | boolean | string;
55
61
  /** The score to assign if the condition is met */
56
62
  score: number;
57
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valentine-efagene/qshelter-common",
3
- "version": "2.0.124",
3
+ "version": "2.0.125",
4
4
  "description": "Shared database schemas and utilities for QShelter services",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -1357,7 +1357,11 @@ model QuestionnairePlanQuestion {
1357
1357
 
1358
1358
  // Scoring
1359
1359
  scoreWeight Int @default(1) // Multiplier for this question's score
1360
- scoringRules Json? // { "employed": 10, "self_employed": 7, "unemployed": 0 } or ranges
1360
+ // ScoringRules format: Array of { operator: ConditionOperator, value: number, score: number }
1361
+ // First matching rule wins. Example:
1362
+ // [{ operator: "GREATER_THAN_OR_EQUAL", value: 3000000, score: 100 },
1363
+ // { operator: "GREATER_THAN_OR_EQUAL", value: 2000000, score: 80 }]
1364
+ scoringRules Json?
1361
1365
 
1362
1366
  // Conditional logic (branching)
1363
1367
  // { "questionKey": "employment_status", "equals": "employed" }