mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Compute nearby-brewery distance in SQL instead of client-side Haversine, and add the spatial index it relies on.
This commit is contained in:
@@ -21,4 +21,7 @@ public sealed class BreweryPost
|
||||
// Navigation Properties
|
||||
public BreweryPostLocation? Location { get; set; }
|
||||
public List<BeerPost> BeerPosts { get; set; } = [];
|
||||
|
||||
// Query-computed
|
||||
public DistanceInformation? Distance { get; set; }
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ namespace Domain.Entities;
|
||||
|
||||
public sealed record CoordinateData(double Latitude, double Longitude);
|
||||
|
||||
/// <summary>The distance, as computed by the database, from a query's origin point to a brewery.</summary>
|
||||
public sealed record DistanceInformation(CoordinateData From, double DistanceMetres);
|
||||
|
||||
public sealed class BreweryPostLocation
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user