@@ -11,27 +11,29 @@ namespace api.Controllers;
1111public class AnalysisController (
1212 ILogger < AnalysisController > logger ,
1313 IAnalysisService analysisService ,
14- IAnalysisTriggerService analysisTriggerService
14+ IAnalysisTriggerService analysisTriggerService ,
15+ IBlobStorageService blobStorageService
1516) : ControllerBase
1617{
1718 [ HttpGet ]
1819 [ Authorize ( Roles = Role . Any ) ]
19- [ ProducesResponseType ( typeof ( PagedResponse < Analysis > ) , StatusCodes . Status200OK ) ]
20+ [ ProducesResponseType ( typeof ( PagedResponse < AnalysisDto > ) , StatusCodes . Status200OK ) ]
2021 [ ProducesResponseType ( StatusCodes . Status400BadRequest ) ]
2122 [ ProducesResponseType ( StatusCodes . Status401Unauthorized ) ]
2223 [ ProducesResponseType ( StatusCodes . Status403Forbidden ) ]
2324 [ ProducesResponseType ( StatusCodes . Status500InternalServerError ) ]
24- public async Task < ActionResult < PagedResponse < Analysis > > > GetAll (
25+ public async Task < ActionResult < PagedResponse < AnalysisDto > > > GetAll (
2526 [ FromQuery ] AnalysisParameters parameters
2627 )
2728 {
2829 try
2930 {
3031 var page = await analysisService . GetAnalyses ( parameters ) ;
32+ var pageDtos = page . Select ( ( p ) => new AnalysisDto ( p , blobStorageService ) ) . ToList ( ) ;
3133 return Ok (
32- new PagedResponse < Analysis >
34+ new PagedResponse < AnalysisDto >
3335 {
34- Items = page ,
36+ Items = pageDtos ,
3537 PageNumber = page . CurrentPage ,
3638 PageSize = page . PageSize ,
3739 TotalCount = page . TotalCount ,
@@ -54,7 +56,7 @@ [FromQuery] AnalysisParameters parameters
5456 [ ProducesResponseType ( StatusCodes . Status401Unauthorized ) ]
5557 [ ProducesResponseType ( StatusCodes . Status403Forbidden ) ]
5658 [ ProducesResponseType ( StatusCodes . Status500InternalServerError ) ]
57- public async Task < ActionResult < Analysis > > GetById ( [ FromRoute ] Guid id )
59+ public async Task < ActionResult < AnalysisDto > > GetById ( [ FromRoute ] Guid id )
5860 {
5961 try
6062 {
@@ -63,7 +65,8 @@ public async Task<ActionResult<Analysis>> GetById([FromRoute] Guid id)
6365 {
6466 return NotFound ( $ "Could not find analysis with id { id } ") ;
6567 }
66- return Ok ( analysis ) ;
68+ var analysisDto = new AnalysisDto ( analysis , blobStorageService ) ;
69+ return Ok ( analysisDto ) ;
6770 }
6871 catch ( Exception e )
6972 {
0 commit comments