// import 'package:cloud_firestore/cloud_firestore.dart'; List monitoredEndpoints = [ "Services/Sentry.svc/REST/MemberLogIN_New", 'Services/DoctorApplication.svc/REST/GetProjectInfo', 'Services/DoctorApplication.svc/REST/DoctorApp_GetDeviceDetailsByIMEI', 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp', 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp', 'Services/Doctors.svc/REST/GetDocProfiles', 'Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts', 'Services/DoctorApplication.svc/REST/GetClinicsForDoctor', 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI', 'Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList', 'Services/DoctorApplication.svc/REST/IsInfectiousDiseasesConsultant', 'Services/DoctorApplication.svc/REST/IsInterventionAccessLevel3Pending', 'Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare', 'Services/DoctorApplication.svc/REST/FetchRadCriticalFinding', 'Services/DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails' ]; void postFailureResponse({ required dynamic doctorId, required String url, required String request, required String response, required String exception, }) async { // Map data = { // "url" : url, // "request" : request, // "response" : response, // "exception" : exception // }; // final firestore = FirebaseFirestore.instance; // final collectionRef = firestore.collection(doctorId.toString()); // await collectionRef.doc(DateTime.now().toIso8601String()).set(data); } void postRequestAndResponse({ required dynamic doctorId, required String completeUrl, required String urlSuffix, required String request, required String response, required String statusCode, }) async { if (!monitoredEndpoints.contains(urlSuffix)) { return; } // print(" the url is being logged "); // Map data = { // "url" : completeUrl, // "request" : request, // "response" : response, // "statusCode" : statusCode, // }; // final firestore = FirebaseFirestore.instance; // // Sanitize urlSuffix to be Firestore-safe // final safeSuffix = urlSuffix.replaceAll(RegExp(r'[^a-zA-Z0-9_-]'), '_'); print(" the url is being logged "); Map data = { "url": completeUrl, "request": request, "response": response, "statusCode": statusCode, }; // final firestore = FirebaseFirestore.instance; // Sanitize urlSuffix to be Firestore-safe final safeSuffix = urlSuffix.replaceAll(RegExp(r'[^a-zA-Z0-9_-]'), '_'); // final collectionRef = firestore.collection('doctors') // .doc(doctorId.toString()) // .collection(safeSuffix); // await collectionRef.doc(DateTime.now().toIso8601String()).set(data); }