https://github.com/sandesh300/Rule-Engine-Application
POSThttp://localhost:8080/api/rules/create{
"ruleName": "rule 1",
"ruleString": "((age > 30 AND department = 'Sales') OR (age < 25 AND department = 'Marketing')) AND (salary > 50000 OR experience > 5)"
}
{
"rule": {
"id": 48,
"ruleName": "rule 1",
"rootNode": {
"id": 315,
"type": "operator",
"left": {
"id": 311,
"type": "operator",
"left": {
"id": 307,
"type": "operator",
"left": {
"id": 305,
"type": "operand",
"left": null,
"right": null,
"value": "age > 30"
},
"right": {
"id": 306,
"type": "operand",
"left": null,
"right": null,
"value": "department = 'Sales'"
},
"value": "AND"
},
"right": {
"id": 310,
"type": "operator",
"left": {
"id": 308,
"type": "operand",
"left": null,
"right": null,
"value": "age < 25"
},
"right": {
"id": 309,
"type": "operand",
"left": null,
"right": null,
"value": "department = 'Marketing'"
},
"value": "AND"
},
"value": "OR"
},
"right": {
"id": 314,
"type": "operator",
"left": {
"id": 312,
"type": "operand",
"left": null,
"right": null,
"value": "salary > 50000"
},
"right": {
"id": 313,
"type": "operand",
"left": null,
"right": null,
"value": "experience > 5"
},
"value": "OR"
},
"value": "AND"
},
"createdAt": [2024, 10, 24, 16, 23, 2, 918946100]
},
"message": "Rule created successfully"
}
POSThttp://localhost:8080/api/rules/evaluate?ruleId=1{
"age": 35,
"department": "Sales",
"salary": 60000,
"experience": 7
}
{
"result": true,
"message": "Rule conditions met",
"evaluatedData": {
"age": 35,
"department": "Sales",
"salary": 60000,
"experience": 7
}
}