Skip to content

Commit

Permalink
Merge pull request #130 from Krzysztofz01/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Krzysztofz01 authored Feb 24, 2024
2 parents d45f7e3 + 0f56f58 commit 80fcf3d
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 48 deletions.
33 changes: 16 additions & 17 deletions src/AccessPointMap/AccessPointMap.API/AccessPointMap.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.2.2" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.4.0" />
<PackageReference Include="HtmlSanitizer" Version="8.0.601" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.12">
<PackageReference Include="Asp.Versioning.Mvc" Version="6.4.1" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
<PackageReference Include="HtmlSanitizer" Version="8.0.843" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Quartz" Version="3.5.0" />
<PackageReference Include="Quartz.AspNetCore" Version="3.5.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.5.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Enrichers.Context" Version="4.6.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Quartz" Version="3.8.0" />
<PackageReference Include="Quartz.AspNetCore" Version="3.8.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.8.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Enrichers.Context" Version="4.6.5" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.3.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.2" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using AccessPointMap.Application.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Quartz;
using Quartz.AspNetCore;

namespace AccessPointMap.API.Configuration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using AccessPointMap.API.Converters;
using Asp.Versioning;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.Extensions.DependencyInjection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AccessPointMap.API.Controllers.Base;
using AccessPointMap.Application.Core.Abstraction;
using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using AccessPointMap.Application.AccessPoints;
using AccessPointMap.Application.Kml.Core;
using AccessPointMap.Infrastructure.Core.Abstraction;
using Asp.Versioning;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
Expand Down Expand Up @@ -341,5 +342,15 @@ public async Task<IActionResult> GetStatisticsMostCommonUsedEncryption(

return await HandleQueryResult(query, true, cancellationToken);
}

[HttpGet("map/center")]
public async Task<IActionResult> GetMapCenterLocation(
CancellationToken cancellationToken)
{
var query = _unitOfWork.AccessPointRepository
.GetAveragePublicAccessPointsLocation(cancellationToken);

return await HandleQueryResult(query, true, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AccessPointMap.API.Controllers.Base;
using AccessPointMap.Application.Authentication;
using AccessPointMap.Application.Core;
using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using AccessPointMap.API.Controllers.Base;
using AccessPointMap.Application.Core.Abstraction;
using Asp.Versioning;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Http;
using System.Threading;
using Asp.Versioning;

namespace AccessPointMap.API.Controllers
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AccessPointMap.API.Controllers.Base;
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AccessPointMap.API.Controllers.Base;
using AccessPointMap.Application.Core;
using AccessPointMap.Infrastructure.Core.Abstraction;
using Asp.Versioning;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="CsvHelper" Version="31.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="CsvHelper" Version="31.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="SharpKml.Core" Version="5.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" />
<PackageReference Include="SharpKml.Core" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.27" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.0" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="FluentValidation" Version="11.4.0" />
<PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="Quartz" Version="3.5.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.5.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.1" />
<PackageReference Include="Quartz" Version="3.8.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.8.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,21 @@ public static async Task<Result<IEnumerable<AccessPoint>>> GetAccessPointsForPre
.ToResultObjectAsync();
}

public static async Task<Result<object>> GetAveragePublicAccessPointsLocation(
this IAccessPointRepository accessPointRepository,
CancellationToken cancellationToken = default)
{
var positions = accessPointRepository.Entities
.Where(a => a.DisplayStatus.Value)
.Select(a => new { Latitude = a.Positioning.HighSignalLatitude, Longitude = a.Positioning.HighSignalLongitude });

return Result.Success<object>(new
{
Latitude = await positions.AverageAsync(p => p.Latitude, cancellationToken),
Longitude = await positions.AverageAsync(p => p.Longitude, cancellationToken)
});
}

private static class Helpers
{
public static bool IsAccessPointInArea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.27" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.12">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async Task<bool> ExistsAsync(string bssid, CancellationToken cancellation
return await _context.AccessPoints
.AsSingleQuery()
.AsNoTracking()
.AnyAsync(a => a.Bssid.Value == bssid, cancellationToken);
.AnyAsync(a => a.Bssid.Value == bssid.ToUpper(), cancellationToken);
}

public async Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default)
Expand All @@ -52,7 +52,7 @@ public async Task<AccessPoint> GetAsync(string bssid, CancellationToken cancella
.Include(a => a.Packets)
.AsSingleQuery()
.AsTracking()
.FirstAsync(a => a.Bssid.Value == bssid, cancellationToken);
.FirstAsync(a => a.Bssid.Value == bssid.ToUpper(), cancellationToken);
}

public async Task<AccessPoint> GetAsync(Guid id, CancellationToken cancellationToken = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.12">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.27" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.27" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async Task<bool> ExistsAsync(string bssid, CancellationToken cancellation
return await _context.AccessPoints
.AsSingleQuery()
.AsNoTracking()
.AnyAsync(a => a.Bssid.Value == bssid, cancellationToken);
.AnyAsync(a => a.Bssid.Value == bssid.ToUpper(), cancellationToken);
}

public async Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default)
Expand All @@ -52,7 +52,7 @@ public async Task<AccessPoint> GetAsync(string bssid, CancellationToken cancella
.Include(a => a.Packets)
.AsSingleQuery()
.AsTracking()
.FirstAsync(a => a.Bssid.Value == bssid, cancellationToken);
.FirstAsync(a => a.Bssid.Value == bssid.ToUpper(), cancellationToken);
}

public async Task<AccessPoint> GetAsync(Guid id, CancellationToken cancellationToken = default)
Expand Down

0 comments on commit 80fcf3d

Please sign in to comment.