@@ -13,7 +13,8 @@ namespace api.Controllers;
1313public class InspectionRecordController (
1414 ILogger < InspectionRecordController > logger ,
1515 IInspectionRecordService inspectionRecordService ,
16- IThermalImageService thermalImageService
16+ IThermalImageService thermalImageService ,
17+ IBlobStorageService blobStorageService
1718) : ControllerBase
1819{
1920 // Workflow types whose output forms the visualization base layer for an
@@ -33,17 +34,23 @@ IThermalImageService thermalImageService
3334 [ ProducesResponseType ( StatusCodes . Status401Unauthorized ) ]
3435 [ ProducesResponseType ( StatusCodes . Status403Forbidden ) ]
3536 [ ProducesResponseType ( StatusCodes . Status500InternalServerError ) ]
36- public async Task < ActionResult < PagedResponse < InspectionRecord > > > GetAll (
37+ public async Task < ActionResult < PagedResponse < InspectionRecordDto > > > GetAll (
3738 [ FromQuery ] InspectionRecordParameters parameters
3839 )
3940 {
4041 try
4142 {
4243 var page = await inspectionRecordService . GetInspectionRecords ( parameters ) ;
44+
45+ var pageDtos = page . Select (
46+ ( record ) => new InspectionRecordDto ( record , blobStorageService )
47+ )
48+ . ToList ( ) ;
49+
4350 return Ok (
44- new PagedResponse < InspectionRecord >
51+ new PagedResponse < InspectionRecordDto >
4552 {
46- Items = page ,
53+ Items = pageDtos ,
4754 PageNumber = page . CurrentPage ,
4855 PageSize = page . PageSize ,
4956 TotalCount = page . TotalCount ,
@@ -66,7 +73,7 @@ [FromQuery] InspectionRecordParameters parameters
6673 [ ProducesResponseType ( StatusCodes . Status401Unauthorized ) ]
6774 [ ProducesResponseType ( StatusCodes . Status403Forbidden ) ]
6875 [ ProducesResponseType ( StatusCodes . Status500InternalServerError ) ]
69- public async Task < ActionResult < InspectionRecord > > GetById ( [ FromRoute ] Guid id )
76+ public async Task < ActionResult < InspectionRecordDto > > GetById ( [ FromRoute ] Guid id )
7077 {
7178 try
7279 {
@@ -75,7 +82,8 @@ public async Task<ActionResult<InspectionRecord>> GetById([FromRoute] Guid id)
7582 {
7683 return NotFound ( $ "Could not find inspection record with id { id } ") ;
7784 }
78- return Ok ( record ) ;
85+ var recordDto = new InspectionRecordDto ( record , blobStorageService ) ;
86+ return Ok ( recordDto ) ;
7987 }
8088 catch ( Exception e )
8189 {
@@ -92,7 +100,7 @@ public async Task<ActionResult<InspectionRecord>> GetById([FromRoute] Guid id)
92100 [ ProducesResponseType ( StatusCodes . Status401Unauthorized ) ]
93101 [ ProducesResponseType ( StatusCodes . Status403Forbidden ) ]
94102 [ ProducesResponseType ( StatusCodes . Status500InternalServerError ) ]
95- public async Task < ActionResult < InspectionRecord > > GetByInspectionId (
103+ public async Task < ActionResult < InspectionRecordDto > > GetByInspectionId (
96104 [ FromRoute ] string inspectionId
97105 )
98106 {
@@ -106,7 +114,8 @@ [FromRoute] string inspectionId
106114 $ "Could not find inspection record with inspection id { inspectionId } "
107115 ) ;
108116 }
109- return Ok ( record ) ;
117+ var recordDto = new InspectionRecordDto ( record , blobStorageService ) ;
118+ return Ok ( recordDto ) ;
110119 }
111120 catch ( Exception e )
112121 {
0 commit comments