mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-04-22 08:56:38 +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; }
|
||||
|
||||
Reference in New Issue
Block a user