From 0eff8931c508f65e394a0489977fe0bd83b780b1 Mon Sep 17 00:00:00 2001 From: Yorick de Wid Date: Wed, 24 Apr 2024 12:18:19 +0200 Subject: [PATCH] Add District entity and update GeocoderController to include District information --- src/FunderMaps.Core/Entities/District.cs | 44 +++++++++++++++++++ .../Controllers/GeocoderController.cs | 4 +- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/FunderMaps.Core/Entities/District.cs diff --git a/src/FunderMaps.Core/Entities/District.cs b/src/FunderMaps.Core/Entities/District.cs new file mode 100644 index 00000000..cb098b11 --- /dev/null +++ b/src/FunderMaps.Core/Entities/District.cs @@ -0,0 +1,44 @@ +using FunderMaps.Core.DataAnnotations; +using System.ComponentModel.DataAnnotations; + +namespace FunderMaps.Core.Entities; + +/// +/// District entity. +/// +public sealed class District : IEntityIdentifier +{ + /// + /// Entity identifier. + /// + public string Identifier => Id; + + /// + /// Unique identifier. + /// + [Required, Geocoder] + public string Id { get; set; } = default!; + + /// + /// District name. + /// + [Required] + public string Name { get; set; } = default!; + + /// + /// Is water district. + /// + public bool Water { get; set; } + + /// + /// External data source id. + /// + [Required] + public string ExternalId { get; set; } = default!; + + /// + /// Municipality identifier. + /// + [Geocoder] + public string? MunicipalityId { get; set; } +} diff --git a/src/FunderMaps.WebApi/Controllers/GeocoderController.cs b/src/FunderMaps.WebApi/Controllers/GeocoderController.cs index 06f83053..aba0cf64 100644 --- a/src/FunderMaps.WebApi/Controllers/GeocoderController.cs +++ b/src/FunderMaps.WebApi/Controllers/GeocoderController.cs @@ -10,7 +10,7 @@ public sealed class GeocoderInfo public Building Building { get; set; } = default!; public Address Address { get; set; } = default!; public Neighborhood? Neighborhood { get; set; } - // TODO: Add Wijk + public District? District { get; set; } // TODO: Add Municipality // TODO: Add Province } @@ -56,7 +56,7 @@ public Task GetNeighborhoodAsync(string id) // GET: api/geocoder/{id} /// - /// Get building by identifier. + /// Get geocoder information by identifier. /// /// /// Cache response for 8 hours. Building will not change often.