feat: implement action builder field configurations and add master data service service layer

This commit is contained in:
azeeee05
2026-08-17 12:12:40 +05:30
parent 4ee9e36e2b
commit 0a06a3856f
7 changed files with 76 additions and 186 deletions
+4 -2
View File
@@ -85,7 +85,8 @@
"isRequired": false,
"width": "half",
"section": "Preferences",
"displayOrder": 9
"displayOrder": 9,
"lookupSource": "currency"
},
{
"fieldCode": "approval_required",
@@ -127,7 +128,8 @@
"isRequired": false,
"width": "half",
"section": "General Information",
"displayOrder": 3
"displayOrder": 3,
"lookupSource": "currency"
}
]
}
+11 -38
View File
@@ -29,17 +29,8 @@
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 3
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 4
"displayOrder": 3,
"lookupSource": "currency"
},
{
"fieldCode": "payment_method",
@@ -49,7 +40,7 @@
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 5
"displayOrder": 4
},
{
"fieldCode": "payment_due_within_days",
@@ -58,7 +49,7 @@
"isRequired": false,
"width": "half",
"section": "Finance",
"displayOrder": 6
"displayOrder": 5
},
{
"fieldCode": "approval_required",
@@ -67,7 +58,7 @@
"isRequired": false,
"width": "full",
"section": "Approval",
"displayOrder": 7
"displayOrder": 6
}
]
},
@@ -81,17 +72,8 @@
"isRequired": true,
"width": "half",
"section": "Goodwill Details",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Goodwill Details",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
},
{
"fieldCode": "reason_code",
@@ -101,7 +83,7 @@
"isRequired": true,
"width": "full",
"section": "Goodwill Details",
"displayOrder": 3
"displayOrder": 2
}
]
},
@@ -115,17 +97,8 @@
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
},
{
"fieldCode": "approval_level",
@@ -135,7 +108,7 @@
"isRequired": true,
"width": "full",
"section": "Approval",
"displayOrder": 3
"displayOrder": 2
}
]
}
+9 -26
View File
@@ -9,17 +9,8 @@
"isRequired": true,
"width": "half",
"section": "General Information",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "General Information",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
},
{
"fieldCode": "meal_type",
@@ -29,7 +20,7 @@
"isRequired": false,
"width": "full",
"section": "General Information",
"displayOrder": 3
"displayOrder": 2
},
{
"fieldCode": "validity_hours",
@@ -38,7 +29,7 @@
"isRequired": true,
"width": "half",
"section": "Restrictions",
"displayOrder": 4
"displayOrder": 3
},
{
"fieldCode": "airport_restriction",
@@ -48,7 +39,7 @@
"isRequired": false,
"width": "full",
"section": "Restrictions",
"displayOrder": 5
"displayOrder": 4
}
]
},
@@ -71,7 +62,8 @@
"isRequired": true,
"width": "half",
"section": "General Information",
"displayOrder": 2
"displayOrder": 2,
"lookupSource": "currency"
},
{
"fieldCode": "expiry_date",
@@ -94,17 +86,8 @@
"isRequired": true,
"width": "half",
"section": "General Information",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "General Information",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
}
]
}
+24 -67
View File
@@ -29,17 +29,8 @@
"isRequired": true,
"width": "half",
"section": "Finance / Payment Gateway",
"displayOrder": 3
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Finance / Payment Gateway",
"displayOrder": 4
"displayOrder": 3,
"lookupSource": "currency"
},
{
"fieldCode": "maximum_refund_limit",
@@ -48,7 +39,8 @@
"isRequired": false,
"width": "half",
"section": "Finance / Payment Gateway",
"displayOrder": 5
"displayOrder": 4,
"lookupSource": "currency"
},
{
"fieldCode": "refund_method",
@@ -58,7 +50,7 @@
"isRequired": true,
"width": "half",
"section": "Finance / Payment Gateway",
"displayOrder": 6
"displayOrder": 5
},
{
"fieldCode": "approval_required",
@@ -67,7 +59,7 @@
"isRequired": false,
"width": "full",
"section": "Finance / Payment Gateway",
"displayOrder": 7
"displayOrder": 6
}
]
},
@@ -110,17 +102,8 @@
"isRequired": false,
"width": "half",
"section": "Finance",
"displayOrder": 4
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 5
"displayOrder": 4,
"lookupSource": "currency"
},
{
"fieldCode": "maximum_refund_limit",
@@ -129,7 +112,8 @@
"isRequired": false,
"width": "half",
"section": "Finance",
"displayOrder": 6
"displayOrder": 5,
"lookupSource": "currency"
},
{
"fieldCode": "refund_method",
@@ -139,7 +123,7 @@
"isRequired": true,
"width": "half",
"section": "Finance",
"displayOrder": 7
"displayOrder": 6
},
{
"fieldCode": "approval_required",
@@ -148,7 +132,7 @@
"isRequired": false,
"width": "full",
"section": "Finance",
"displayOrder": 8
"displayOrder": 7
}
]
},
@@ -182,17 +166,8 @@
"isRequired": true,
"width": "half",
"section": "Refund Amount",
"displayOrder": 3
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Refund Method",
"displayOrder": 4
"displayOrder": 3,
"lookupSource": "currency"
},
{
"fieldCode": "refund_method",
@@ -202,7 +177,7 @@
"isRequired": true,
"width": "half",
"section": "Refund Method",
"displayOrder": 5
"displayOrder": 4
},
{
"fieldCode": "approval_required",
@@ -211,7 +186,7 @@
"isRequired": false,
"width": "full",
"section": "Approval Required",
"displayOrder": 6
"displayOrder": 5
}
]
},
@@ -245,17 +220,8 @@
"isRequired": true,
"width": "half",
"section": "Refund Amount",
"displayOrder": 3
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Refund Method",
"displayOrder": 4
"displayOrder": 3,
"lookupSource": "currency"
},
{
"fieldCode": "refund_method",
@@ -265,7 +231,7 @@
"isRequired": true,
"width": "half",
"section": "Refund Method",
"displayOrder": 5
"displayOrder": 4
},
{
"fieldCode": "approval_required",
@@ -274,7 +240,7 @@
"isRequired": false,
"width": "full",
"section": "Approval Required",
"displayOrder": 6
"displayOrder": 5
}
]
},
@@ -318,17 +284,8 @@
"isRequired": true,
"width": "half",
"section": "Refund Amount",
"displayOrder": 4
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Refund Method",
"displayOrder": 5
"displayOrder": 4,
"lookupSource": "currency"
},
{
"fieldCode": "refund_method",
@@ -338,7 +295,7 @@
"isRequired": true,
"width": "half",
"section": "Refund Method",
"displayOrder": 6
"displayOrder": 5
},
{
"fieldCode": "approval_required",
@@ -347,7 +304,7 @@
"isRequired": false,
"width": "full",
"section": "Approval Required",
"displayOrder": 7
"displayOrder": 6
}
]
}
+6 -24
View File
@@ -9,17 +9,8 @@
"isRequired": true,
"width": "half",
"section": "Ground Transport",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Ground Transport",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
},
{
"fieldCode": "pickup_radius_km",
@@ -28,7 +19,7 @@
"isRequired": true,
"width": "half",
"section": "Ground Transport",
"displayOrder": 3
"displayOrder": 2
},
{
"fieldCode": "destination_type",
@@ -38,7 +29,7 @@
"isRequired": true,
"width": "half",
"section": "Ground Transport",
"displayOrder": 4
"displayOrder": 3
}
]
},
@@ -110,17 +101,8 @@
"isRequired": true,
"width": "half",
"section": "Partner API",
"displayOrder": 2
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "full",
"section": "Partner API",
"displayOrder": 3
"displayOrder": 2,
"lookupSource": "currency"
}
]
},
+12 -29
View File
@@ -9,17 +9,8 @@
"isRequired": true,
"width": "half",
"section": "Voucher Details",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Voucher Details",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
},
{
"fieldCode": "validity_months",
@@ -28,7 +19,7 @@
"isRequired": true,
"width": "half",
"section": "Voucher Rules",
"displayOrder": 3
"displayOrder": 2
},
{
"fieldCode": "transferable",
@@ -37,7 +28,7 @@
"isRequired": false,
"width": "half",
"section": "Voucher Rules",
"displayOrder": 4
"displayOrder": 3
},
{
"fieldCode": "applicable_routes",
@@ -47,7 +38,7 @@
"isRequired": false,
"width": "full",
"section": "Voucher Rules",
"displayOrder": 5
"displayOrder": 4
},
{
"fieldCode": "fare_classes",
@@ -57,7 +48,7 @@
"isRequired": false,
"width": "full",
"section": "Voucher Rules",
"displayOrder": 6
"displayOrder": 5
}
]
},
@@ -71,17 +62,8 @@
"isRequired": true,
"width": "half",
"section": "Credit Details",
"displayOrder": 1
},
{
"fieldCode": "currency",
"fieldName": "Currency",
"fieldType": "dropdown",
"lookupSource": "currency",
"isRequired": true,
"width": "half",
"section": "Credit Details",
"displayOrder": 2
"displayOrder": 1,
"lookupSource": "currency"
},
{
"fieldCode": "expiry_date",
@@ -90,7 +72,7 @@
"isRequired": true,
"width": "half",
"section": "Credit Rules",
"displayOrder": 3
"displayOrder": 2
},
{
"fieldCode": "eligible_fare_types",
@@ -100,7 +82,7 @@
"isRequired": false,
"width": "full",
"section": "Credit Rules",
"displayOrder": 4
"displayOrder": 3
}
]
},
@@ -156,7 +138,8 @@
"isRequired": false,
"width": "half",
"section": "Discount Details",
"displayOrder": 2
"displayOrder": 2,
"lookupSource": "currency"
},
{
"fieldCode": "expiry_date",
@@ -1006,6 +1006,16 @@ export class MasterDataService implements OnModuleInit {
continue;
}
const existingFields = await this.fieldDefinitionRepo.find({ where: { actionTypeId: actionType.id } });
const newFieldCodes = actionConfig.fields.map((f: any) => f.fieldCode);
for (const existing of existingFields) {
if (!newFieldCodes.includes(existing.fieldCode)) {
await this.fieldDefinitionRepo.remove(existing);
}
}
for (const field of actionConfig.fields) {
const existingField = await this.fieldDefinitionRepo.findOne({
where: { actionTypeId: actionType.id, fieldCode: field.fieldCode }