22using api . Database . Models ;
33using api . MQTT ;
44using api . Services ;
5+ using Api . Utilities ;
56using Microsoft . AspNetCore . Authorization ;
67using Microsoft . AspNetCore . Mvc ;
78
@@ -83,23 +84,22 @@ public async Task<ActionResult<PlantDataResponse>> AnonymizerDone(
8384 [ FromBody ] AnonymizerDoneNotification notification
8485 )
8586 {
87+ var inspectionId = Sanitize . SanitizeUserInput ( notification . InspectionId ) ;
8688 // TODO: Update plantData with information that the Anonymizer is Done
8789 logger . LogInformation (
8890 "Completed anonymization of plantData with inspection id {id}" ,
89- notification . InspectionId
91+ inspectionId
9092 ) ;
9193
92- var plantData = await plantDataService . ReadByInspectionId ( notification . InspectionId ) ;
94+ var plantData = await plantDataService . ReadByInspectionId ( inspectionId ) ;
9395 if ( plantData == null )
9496 {
95- return NotFound (
96- $ "Could not find plantData with inspection id { notification . InspectionId } "
97- ) ;
97+ return NotFound ( $ "Could not find plantData with inspection id { inspectionId } ") ;
9898 }
9999
100100 var message = new SaraVisualizationAvailableMessage
101101 {
102- InspectionId = notification . InspectionId ,
102+ InspectionId = inspectionId ,
103103 StorageAccount = plantData . AnonymizedBlobStorageLocation . StorageAccount ,
104104 BlobContainer = plantData . AnonymizedBlobStorageLocation . BlobContainer ,
105105 BlobName = plantData . AnonymizedBlobStorageLocation . BlobName ,
@@ -108,7 +108,7 @@ [FromBody] AnonymizerDoneNotification notification
108108 mqttMessageService . OnSaraVisualizationAvailable ( message ) ;
109109
110110 var updatedPlantData = await plantDataService . UpdateAnonymizerWorkflowStatus (
111- notification . InspectionId ,
111+ inspectionId ,
112112 WorkflowStatus . ExitSuccess
113113 ) ;
114114
@@ -127,24 +127,23 @@ public async Task<ActionResult<PlantDataResponse>> ConstantLevelOilerCompleted(
127127 [ FromBody ] ConstantLevelOilerDoneNotification notification
128128 )
129129 {
130+ var inspectionId = Sanitize . SanitizeUserInput ( notification . InspectionId ) ;
130131 // TODO: Update plantData with information that the CLO is Done
131132 logger . LogInformation (
132133 "Completed Constant Level Oiler analysis for plantData with inspection id {id} and oil level {oilLevel}" ,
133- notification . InspectionId ,
134+ inspectionId ,
134135 notification . OilLevel
135136 ) ;
136137
137- var plantData = await plantDataService . ReadByInspectionId ( notification . InspectionId ) ;
138+ var plantData = await plantDataService . ReadByInspectionId ( inspectionId ) ;
138139 if ( plantData == null )
139140 {
140- return NotFound (
141- $ "Could not find plantData with inspection id { notification . InspectionId } "
142- ) ;
141+ return NotFound ( $ "Could not find plantData with inspection id { inspectionId } ") ;
143142 }
144143
145144 var message = new SaraAnalysisResultMessage
146145 {
147- InspectionId = notification . InspectionId ,
146+ InspectionId = inspectionId ,
148147 AnalysisType = Analysis . TypeToString ( AnalysisType . ConstantLevelOiler ) ,
149148 RegressionResult = notification . OilLevel ,
150149 StorageAccount = plantData . VisualizedBlobStorageLocation . StorageAccount ,
@@ -170,7 +169,7 @@ public ActionResult FencillaDone([FromBody] FencillaDoneNotification notificatio
170169 // TODO: Update plantData with information that Fencilla is Done
171170 logger . LogInformation (
172171 "Completed Fencilla analysis for plantData with inspection id {id} and break found is {IsBreak} with confidence {Confidence}" ,
173- notification . InspectionId ,
172+ Sanitize . SanitizeUserInput ( notification . InspectionId ) ,
174173 notification . IsBreak ,
175174 notification . Confidence
176175 ) ;
0 commit comments