Skip to content

Commit

Permalink
multi site scan
Browse files Browse the repository at this point in the history
  • Loading branch information
koskedk committed May 18, 2020
1 parent 86a4419 commit 9b5a4f6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public async Task<Result> Handle(RefreshIndex request, CancellationToken cancell

while (page <= pageCount)
{
Log.Debug($"Reading {page} of {pageCount}...");
var mpis = await _reader.Read(page, request.BatchSize);

var pis= Mapper.Map<List<SubjectIndex>>(mpis);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Dwapi.Bot.Core.Application.Indices.Commands
public class RefreshIndex:IRequest<Result>
{
public int BatchSize { get; }

public RefreshIndex(int batchSize)
{
BatchSize = batchSize;
Expand Down
18 changes: 18 additions & 0 deletions src/Dwapi.Bot.Core/Domain/Indices/Dto/RefreshIndexDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Dwapi.Bot.Core.Application.Indices.Commands;

namespace Dwapi.Bot.Core.Domain.Indices.Dto
{
public class RefreshIndexDto
{
public int BatchSize { get; set; }

public RefreshIndexDto()
{
}

public RefreshIndex GenerateCommand()
{
return new RefreshIndex(BatchSize);
}
}
}
6 changes: 3 additions & 3 deletions src/Dwapi.Bot/Controllers/WorkerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public WorkerController(IMediator mediator, ISubjectIndexRepository repository)
}

[HttpPost("Refresh")]
public async Task<ActionResult> Get(RefreshIndex command)
public async Task<ActionResult> Post([FromBody] RefreshIndexDto command)
{
if (command.BatchSize <= 0)
return BadRequest();

try
{
var results = await _mediator.Send(command);
var results = await _mediator.Send(command.GenerateCommand());

if (results.IsSuccess)
return Ok("Refreshing...");
Expand All @@ -52,7 +52,7 @@ public async Task<ActionResult> Get(RefreshIndex command)
}

[HttpPost("Scan")]
public async Task<ActionResult> Get(ScanDto command)
public async Task<ActionResult> Post([FromBody] ScanDto command)
{
var results = new List<Result>();
var siteCodes = new List<int>();
Expand Down
5 changes: 1 addition & 4 deletions src/Dwapi.Bot/Dwapi.Bot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
</ItemGroup>

<ItemGroup>
<Content Include="logs\wwwroot\index.html">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Folder Include="logs" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Dwapi.Bot/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void ConfigureServices(IServiceCollection services)

services.AddTransient<IJaroWinklerScorer, JaroWinklerScorer>();
services.AddTransient<IMasterPatientIndexReader>(s =>
new MasterPatientIndexReader(new DataSourceInfo(DbType.SQLite, mpiConnectionString)));
new MasterPatientIndexReader(new DataSourceInfo(DbType.MsSQL, mpiConnectionString)));
services.AddScoped<IMatchConfigRepository, MatchConfigRepository>();
services.AddScoped<ISubjectIndexRepository, SubjectIndexRepository>();
services.AddMediatR(typeof(RefreshIndex).Assembly, typeof(IndexRefreshed).Assembly);
Expand Down

0 comments on commit 9b5a4f6

Please sign in to comment.