diff --git a/src/AccessPointMap/AccessPointMap.API/AccessPointMap.API.csproj b/src/AccessPointMap/AccessPointMap.API/AccessPointMap.API.csproj index 2e6dfee7..78e1100b 100644 --- a/src/AccessPointMap/AccessPointMap.API/AccessPointMap.API.csproj +++ b/src/AccessPointMap/AccessPointMap.API/AccessPointMap.API.csproj @@ -6,28 +6,27 @@ - - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + - - + + diff --git a/src/AccessPointMap/AccessPointMap.API/Configuration/BackgroundJobConfiguration.cs b/src/AccessPointMap/AccessPointMap.API/Configuration/BackgroundJobConfiguration.cs index a5df2066..d66ed948 100644 --- a/src/AccessPointMap/AccessPointMap.API/Configuration/BackgroundJobConfiguration.cs +++ b/src/AccessPointMap/AccessPointMap.API/Configuration/BackgroundJobConfiguration.cs @@ -2,6 +2,7 @@ using AccessPointMap.Application.Extensions; using Microsoft.Extensions.DependencyInjection; using Quartz; +using Quartz.AspNetCore; namespace AccessPointMap.API.Configuration { diff --git a/src/AccessPointMap/AccessPointMap.API/Configuration/WebApiUtilitiesConfiguration.cs b/src/AccessPointMap/AccessPointMap.API/Configuration/WebApiUtilitiesConfiguration.cs index 5f62ac99..7c7b15c2 100644 --- a/src/AccessPointMap/AccessPointMap.API/Configuration/WebApiUtilitiesConfiguration.cs +++ b/src/AccessPointMap/AccessPointMap.API/Configuration/WebApiUtilitiesConfiguration.cs @@ -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; diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointCommandController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointCommandController.cs index 9c05e7b9..4e28eaa4 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointCommandController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointCommandController.cs @@ -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; diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointQueryController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointQueryController.cs index ea98cc0d..c963f4c9 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointQueryController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/AccessPointQueryController.cs @@ -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; @@ -341,5 +342,15 @@ public async Task GetStatisticsMostCommonUsedEncryption( return await HandleQueryResult(query, true, cancellationToken); } + + [HttpGet("map/center")] + public async Task GetMapCenterLocation( + CancellationToken cancellationToken) + { + var query = _unitOfWork.AccessPointRepository + .GetAveragePublicAccessPointsLocation(cancellationToken); + + return await HandleQueryResult(query, true, cancellationToken); + } } } diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/AuthenticationController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/AuthenticationController.cs index fc60cfd1..9eb177e7 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/AuthenticationController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/AuthenticationController.cs @@ -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; diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityCommandController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityCommandController.cs index 3847cd89..e1a748d6 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityCommandController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityCommandController.cs @@ -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; diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityQueryController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityQueryController.cs index 4a760ebe..f374eb76 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityQueryController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/IdentityQueryController.cs @@ -12,6 +12,7 @@ using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.Http; using System.Threading; +using Asp.Versioning; namespace AccessPointMap.API.Controllers { diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationCommandController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationCommandController.cs index a7314438..9425091b 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationCommandController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationCommandController.cs @@ -1,4 +1,5 @@ using AccessPointMap.API.Controllers.Base; +using Asp.Versioning; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; diff --git a/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationQueryController.cs b/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationQueryController.cs index 2ac1e475..159851b5 100644 --- a/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationQueryController.cs +++ b/src/AccessPointMap/AccessPointMap.API/Controllers/IntegrationQueryController.cs @@ -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; diff --git a/src/AccessPointMap/AccessPointMap.Application.Integration.Aircrackng/AccessPointMap.Application.Integration.Aircrackng.csproj b/src/AccessPointMap/AccessPointMap.Application.Integration.Aircrackng/AccessPointMap.Application.Integration.Aircrackng.csproj index 33e224e9..3a2ae990 100644 --- a/src/AccessPointMap/AccessPointMap.Application.Integration.Aircrackng/AccessPointMap.Application.Integration.Aircrackng.csproj +++ b/src/AccessPointMap/AccessPointMap.Application.Integration.Aircrackng/AccessPointMap.Application.Integration.Aircrackng.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/AccessPointMap/AccessPointMap.Application.Integration.Wigle/AccessPointMap.Application.Integration.Wigle.csproj b/src/AccessPointMap/AccessPointMap.Application.Integration.Wigle/AccessPointMap.Application.Integration.Wigle.csproj index 33e224e9..3a2ae990 100644 --- a/src/AccessPointMap/AccessPointMap.Application.Integration.Wigle/AccessPointMap.Application.Integration.Wigle.csproj +++ b/src/AccessPointMap/AccessPointMap.Application.Integration.Wigle/AccessPointMap.Application.Integration.Wigle.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/AccessPointMap/AccessPointMap.Application.Kml.Sharpkml/AccessPointMap.Application.Kml.Sharpkml.csproj b/src/AccessPointMap/AccessPointMap.Application.Kml.Sharpkml/AccessPointMap.Application.Kml.Sharpkml.csproj index 4a544148..852436e2 100644 --- a/src/AccessPointMap/AccessPointMap.Application.Kml.Sharpkml/AccessPointMap.Application.Kml.Sharpkml.csproj +++ b/src/AccessPointMap/AccessPointMap.Application.Kml.Sharpkml/AccessPointMap.Application.Kml.Sharpkml.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/AccessPointMap/AccessPointMap.Application.Oui.MacTwoVendor/AccessPointMap.Application.Oui.MacTwoVendor.csproj b/src/AccessPointMap/AccessPointMap.Application.Oui.MacTwoVendor/AccessPointMap.Application.Oui.MacTwoVendor.csproj index 6d89ae90..576cec5d 100644 --- a/src/AccessPointMap/AccessPointMap.Application.Oui.MacTwoVendor/AccessPointMap.Application.Oui.MacTwoVendor.csproj +++ b/src/AccessPointMap/AccessPointMap.Application.Oui.MacTwoVendor/AccessPointMap.Application.Oui.MacTwoVendor.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/src/AccessPointMap/AccessPointMap.Application.Pcap.ApmPcapNative/AccessPointMap.Application.Pcap.ApmPcapNative.csproj b/src/AccessPointMap/AccessPointMap.Application.Pcap.ApmPcapNative/AccessPointMap.Application.Pcap.ApmPcapNative.csproj index 09b84745..4b819d45 100644 --- a/src/AccessPointMap/AccessPointMap.Application.Pcap.ApmPcapNative/AccessPointMap.Application.Pcap.ApmPcapNative.csproj +++ b/src/AccessPointMap/AccessPointMap.Application.Pcap.ApmPcapNative/AccessPointMap.Application.Pcap.ApmPcapNative.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/AccessPointMap/AccessPointMap.Application/AccessPointMap.Application.csproj b/src/AccessPointMap/AccessPointMap.Application/AccessPointMap.Application.csproj index 20c626aa..31495f70 100644 --- a/src/AccessPointMap/AccessPointMap.Application/AccessPointMap.Application.csproj +++ b/src/AccessPointMap/AccessPointMap.Application/AccessPointMap.Application.csproj @@ -5,15 +5,15 @@ - + - + - + - - - + + + diff --git a/src/AccessPointMap/AccessPointMap.Application/AccessPoints/Queries.cs b/src/AccessPointMap/AccessPointMap.Application/AccessPoints/Queries.cs index d0263b23..95b3a1e0 100644 --- a/src/AccessPointMap/AccessPointMap.Application/AccessPoints/Queries.cs +++ b/src/AccessPointMap/AccessPointMap.Application/AccessPoints/Queries.cs @@ -548,6 +548,21 @@ public static async Task>> GetAccessPointsForPre .ToResultObjectAsync(); } + public static async Task> 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(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( diff --git a/src/AccessPointMap/AccessPointMap.Domain.Test/AccessPointMap.Domain.Test.csproj b/src/AccessPointMap/AccessPointMap.Domain.Test/AccessPointMap.Domain.Test.csproj index 95a3ac43..56b227fe 100644 --- a/src/AccessPointMap/AccessPointMap.Domain.Test/AccessPointMap.Domain.Test.csproj +++ b/src/AccessPointMap/AccessPointMap.Domain.Test/AccessPointMap.Domain.Test.csproj @@ -7,13 +7,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/AccessPointMap/AccessPointMap.Infrastructure.Core/AccessPointMap.Infrastructure.Core.csproj b/src/AccessPointMap/AccessPointMap.Infrastructure.Core/AccessPointMap.Infrastructure.Core.csproj index ce655c80..7a681a1d 100644 --- a/src/AccessPointMap/AccessPointMap.Infrastructure.Core/AccessPointMap.Infrastructure.Core.csproj +++ b/src/AccessPointMap/AccessPointMap.Infrastructure.Core/AccessPointMap.Infrastructure.Core.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/AccessPointMap.Infrastructure.MySql.csproj b/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/AccessPointMap.Infrastructure.MySql.csproj index 0fb13586..8b90682f 100644 --- a/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/AccessPointMap.Infrastructure.MySql.csproj +++ b/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/AccessPointMap.Infrastructure.MySql.csproj @@ -6,9 +6,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/Repositories/AccessPointRepository.cs b/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/Repositories/AccessPointRepository.cs index e353fd4e..d9694711 100644 --- a/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/Repositories/AccessPointRepository.cs +++ b/src/AccessPointMap/AccessPointMap.Infrastructure.MySql/Repositories/AccessPointRepository.cs @@ -33,7 +33,7 @@ public async Task 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 ExistsAsync(Guid id, CancellationToken cancellationToken = default) @@ -52,7 +52,7 @@ public async Task 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 GetAsync(Guid id, CancellationToken cancellationToken = default) diff --git a/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/AccessPointMap.Infrastructure.Sqlite.csproj b/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/AccessPointMap.Infrastructure.Sqlite.csproj index 3fde89f6..7918521d 100644 --- a/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/AccessPointMap.Infrastructure.Sqlite.csproj +++ b/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/AccessPointMap.Infrastructure.Sqlite.csproj @@ -6,13 +6,13 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/Repositories/AccessPointRepository.cs b/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/Repositories/AccessPointRepository.cs index 80338bd9..38b29134 100644 --- a/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/Repositories/AccessPointRepository.cs +++ b/src/AccessPointMap/AccessPointMap.Infrastructure.Sqlite/Repositories/AccessPointRepository.cs @@ -33,7 +33,7 @@ public async Task 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 ExistsAsync(Guid id, CancellationToken cancellationToken = default) @@ -52,7 +52,7 @@ public async Task 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 GetAsync(Guid id, CancellationToken cancellationToken = default)