mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-04-22 09:26:39 +00:00
tiels are cached and reused properly
This commit is contained in:
@@ -9,9 +9,13 @@ using SatelliteProvider.Common.Configs;
|
||||
using SatelliteProvider.Common.DTO;
|
||||
using SatelliteProvider.Common.Interfaces;
|
||||
using SatelliteProvider.Services;
|
||||
using Serilog;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Host.UseSerilog((context, configuration) =>
|
||||
configuration.ReadFrom.Configuration(context.Configuration));
|
||||
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
|
||||
?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
|
||||
|
||||
@@ -130,6 +134,7 @@ async Task<IResult> DownloadSingleTile([FromBody] DownloadTileRequest request, G
|
||||
request.ZoomLevel);
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
var currentVersion = now.Year;
|
||||
var tileEntity = new TileEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
@@ -140,6 +145,7 @@ async Task<IResult> DownloadSingleTile([FromBody] DownloadTileRequest request, G
|
||||
TileSizePixels = 256,
|
||||
ImageType = "jpg",
|
||||
MapsVersion = $"downloaded_{now:yyyy-MM-dd}",
|
||||
Version = currentVersion,
|
||||
FilePath = downloadedTile.FilePath,
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
@@ -158,6 +164,7 @@ async Task<IResult> DownloadSingleTile([FromBody] DownloadTileRequest request, G
|
||||
TileSizePixels = tileEntity.TileSizePixels,
|
||||
ImageType = tileEntity.ImageType,
|
||||
MapsVersion = tileEntity.MapsVersion,
|
||||
Version = currentVersion,
|
||||
FilePath = tileEntity.FilePath,
|
||||
CreatedAt = tileEntity.CreatedAt,
|
||||
UpdatedAt = tileEntity.UpdatedAt
|
||||
@@ -289,6 +296,7 @@ public record DownloadTileResponse
|
||||
public int TileSizePixels { get; set; }
|
||||
public string ImageType { get; set; } = string.Empty;
|
||||
public string? MapsVersion { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string FilePath { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.21"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
"Override": {
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
"Override": {
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
{ "Name": "Console" },
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "./logs/satellite-provider-.log",
|
||||
"rollingInterval": "Day",
|
||||
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
|
||||
Reference in New Issue
Block a user