Skip to content

Commit 1bcb32b

Browse files
committed
code comment changes
Signed-off-by: Lillie Dae <[email protected]>
1 parent 2a8bb5d commit 1bcb32b

File tree

9 files changed

+21
-23
lines changed

9 files changed

+21
-23
lines changed

docs/api/rest/dicom-association.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
# DICOM Association information
1818

19-
The `/dai' endpoint is for retrieving a list of information regarding dicom
19+
The `/dicom-associations' endpoint is for retrieving a list of information regarding dicom
2020
associations.
2121

22-
## GET /dai/
22+
## GET /dicom-associations/
2323

2424
#### Query Parameters
2525

src/Configuration/EndpointSettings.cs renamed to src/Configuration/HttpEndpointSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace Monai.Deploy.InformaticsGateway.Configuration
2121
{
22-
public class EndpointSettings
22+
public class HttpEndpointSettings
2323
{
2424
[ConfigurationKeyName("defaultPageSize")]
2525
public int DefaultPageSize { get; set; } = 10;

src/Configuration/InformaticsGatewayConfiguration.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ public class InformaticsGatewayConfiguration
8282
[ConfigurationKeyName("plugins")]
8383
public PlugInConfiguration PlugInConfigurations { get; set; }
8484

85-
/// <summary>
86-
/// Represents the <c>endpointSettings</c> section of the configuration file.
87-
/// </summary>
88-
[ConfigurationKeyName("endpointSettings")]
89-
public EndpointSettings EndpointSettings { get; set; }
9085

9186
public InformaticsGatewayConfiguration()
9287
{
@@ -99,7 +94,6 @@ public InformaticsGatewayConfiguration()
9994
Database = new DatabaseConfiguration();
10095
Hl7 = new Hl7Configuration();
10196
PlugInConfigurations = new PlugInConfiguration();
102-
EndpointSettings = new EndpointSettings();
10397
}
10498
}
10599
}

src/InformaticsGateway/Logging/Log.0.General.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,5 @@ public static partial class Log
5959

6060
[LoggerMessage(EventId = 13, Level = LogLevel.Critical, Message = "Failed to start {ServiceName}.")]
6161
public static partial void ServiceFailedToStart(this ILogger logger, string serviceName, Exception ex);
62-
63-
[LoggerMessage(EventId = 14, Level = LogLevel.Error, Message = "Unexpected error occurred in GET /dai API..")]
64-
public static partial void DAIControllerGetAllAsyncError(this ILogger logger, Exception ex);
6562
}
6663
}

src/InformaticsGateway/Logging/Log.8000.HttpServices.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,5 +173,11 @@ public static partial class Log
173173

174174
[LoggerMessage(EventId = 8204, Level = LogLevel.Error, Message = "Failed to store FHIR resource.")]
175175
public static partial void ErrorStoringFhirResource(this ILogger logger, Exception ex);
176+
177+
//
178+
// Dicom Associations Controller.
179+
//
180+
[LoggerMessage(EventId = 8300, Level = LogLevel.Error, Message = "Unexpected error occurred in GET /dicom-associations API..")]
181+
public static partial void DicomAssociationsControllerGetError(this ILogger logger, Exception ex);
176182
}
177183
}

src/InformaticsGateway/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
9797
.ConfigureServices((hostContext, services) =>
9898
{
9999
services.AddOptions<InformaticsGatewayConfiguration>().Bind(hostContext.Configuration.GetSection("InformaticsGateway"));
100+
services.AddOptions<HttpEndpointSettings>().Bind(hostContext.Configuration.GetSection("InformaticsGateway:httpEndpointSettings"));
100101
services.AddOptions<MessageBrokerServiceConfiguration>().Bind(hostContext.Configuration.GetSection("InformaticsGateway:messaging"));
101102
services.AddOptions<StorageServiceConfiguration>().Bind(hostContext.Configuration.GetSection("InformaticsGateway:storage"));
102103
services.AddOptions<AuthenticationOptions>().Bind(hostContext.Configuration.GetSection("MonaiDeployAuthentication"));

src/InformaticsGateway/Services/Http/DicomAssociationInfoController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232

3333
namespace Monai.Deploy.InformaticsGateway.Services.Http
3434
{
35-
[Route("dai")]
35+
[Route("dicom-associations")]
3636
public class DicomAssociationInfoController : PagedApiControllerBase
3737
{
38-
private const string Endpoint = "/dai";
38+
private const string Endpoint = "/dicom-associations";
3939
private readonly ILogger<DicomAssociationInfoController> _logger;
4040
private readonly IDicomAssociationInfoRepository _dicomRepo;
4141
private readonly IUriService _uriService;
4242

4343
public DicomAssociationInfoController(ILogger<DicomAssociationInfoController> logger,
44-
IOptions<InformaticsGatewayConfiguration> options,
44+
IOptions<HttpEndpointSettings> options,
4545
IDicomAssociationInfoRepository dicomRepo,
4646
IUriService uriService) : base(options)
4747
{
@@ -63,13 +63,13 @@ public async Task<IActionResult> GetAllAsync([FromQuery] TimeFilter filter)
6363
try
6464
{
6565
var route = Request?.Path.Value ?? string.Empty;
66-
var pageSize = filter.PageSize ?? EndpointOptions.Value.EndpointSettings.DefaultPageSize;
66+
var pageSize = filter.PageSize ?? EndpointOptions.Value.DefaultPageSize;
6767
var validFilter = new TimeFilter(
6868
filter.StartTime,
6969
filter.EndTime,
7070
filter.PageNumber ?? 0,
7171
pageSize,
72-
EndpointOptions.Value.EndpointSettings.MaxPageSize);
72+
EndpointOptions.Value.MaxPageSize);
7373

7474
var pagedData = await _dicomRepo.GetAllAsync(
7575
validFilter.GetSkip(),
@@ -83,7 +83,7 @@ public async Task<IActionResult> GetAllAsync([FromQuery] TimeFilter filter)
8383
}
8484
catch (Exception e)
8585
{
86-
_logger.DAIControllerGetAllAsyncError(e);
86+
_logger.DicomAssociationsControllerGetError(e);
8787
return Problem($"Unexpected error occurred: {e.Message}", Endpoint, InternalServerError);
8888
}
8989
}

src/InformaticsGateway/Services/Http/PagedApiControllerBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ namespace Monai.Deploy.InformaticsGateway.Services.Http
2727
{
2828
public class PagedApiControllerBase : ApiControllerBase
2929
{
30-
protected readonly IOptions<InformaticsGatewayConfiguration> EndpointOptions;
30+
protected readonly IOptions<HttpEndpointSettings> EndpointOptions;
3131

32-
public PagedApiControllerBase(IOptions<InformaticsGatewayConfiguration> options)
32+
public PagedApiControllerBase(IOptions<HttpEndpointSettings> options)
3333
{
3434
EndpointOptions = options ?? throw new ArgumentNullException(nameof(options));
3535
}
@@ -51,7 +51,7 @@ public PagedResponse<IEnumerable<T>> CreatePagedResponse<T>(IEnumerable<T> paged
5151
Guard.Against.Null(route, nameof(route));
5252
Guard.Against.Null(uriService, nameof(uriService));
5353

54-
var pageSize = validFilter.PageSize ?? EndpointOptions.Value.EndpointSettings.DefaultPageSize;
54+
var pageSize = validFilter.PageSize ?? EndpointOptions.Value.DefaultPageSize;
5555
var response = new PagedResponse<IEnumerable<T>>(pagedData, validFilter.PageNumber ?? 0, pageSize);
5656

5757
response.SetUp(validFilter, totalRecords, uriService, route);

src/InformaticsGateway/Test/Services/Http/DicomAssociationInfoControllerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class DicomAssociationInfoControllerTest
3838
private readonly Mock<ILogger<DicomAssociationInfoController>> _logger;
3939
private Mock<ILoggerFactory> _loggerFactory;
4040
private readonly DicomAssociationInfoController _controller;
41-
private readonly IOptions<InformaticsGatewayConfiguration> _options;
41+
private readonly IOptions<HttpEndpointSettings> _options;
4242
private readonly Mock<IDicomAssociationInfoRepository> _repo;
4343
private readonly UriService _uriService;
4444

@@ -48,7 +48,7 @@ public DicomAssociationInfoControllerTest()
4848
_logger = new Mock<ILogger<DicomAssociationInfoController>>();
4949
_repo = new Mock<IDicomAssociationInfoRepository>();
5050
_loggerFactory.Setup(p => p.CreateLogger(It.IsAny<string>())).Returns(_logger.Object);
51-
_options = Options.Create(new InformaticsGatewayConfiguration());
51+
_options = Options.Create(new HttpEndpointSettings());
5252
_uriService = new UriService(new Uri("https://test.com/"));
5353

5454
_controller = new DicomAssociationInfoController(_logger.Object, _options, _repo.Object, _uriService);

0 commit comments

Comments
 (0)