applyChangeApproval static method
Applies an approved change request to its target entity. Returns true on success. Currently handles 'releaseItem'; other target types (e.g. ERP) are handled by their own modules.
Implementation
static Future<bool> applyChangeApproval(AppRequest request) async {
AppConfig.logger.d("Applying change approval ${request.id} (${request.changeTargetType})");
final changes = request.changes;
if (changes.isEmpty) return false;
switch (request.changeTargetType) {
case 'releaseItem':
final fields = Map<String, dynamic>.from(changes);
fields[AppFirestoreConstants.modifiedTime] = DateTime.now().millisecondsSinceEpoch;
return await AppReleaseItemFirestore().updateFields(request.changeTargetId, fields);
default:
AppConfig.logger.w("Unhandled change target type: ${request.changeTargetType}");
return false;
}
}