summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Database/Tables/Place.cs
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-12-03 21:49:20 +0100
committerivar <i@oiee.no>2025-12-03 21:49:20 +0100
commitcd70f54266d708867a1eb35870bc755bc5b2df32 (patch)
treef0a8ec571ef3f345ac74293b4cb11918878b3ed5 /api/WhatApi/Database/Tables/Place.cs
parent5bd9ad8bd1740dcff179d66718532086304ca4c4 (diff)
downloadwhat-cd70f54266d708867a1eb35870bc755bc5b2df32.tar.xz
what-cd70f54266d708867a1eb35870bc755bc5b2df32.zip
Refactor db
Diffstat (limited to 'api/WhatApi/Database/Tables/Place.cs')
-rw-r--r--api/WhatApi/Database/Tables/Place.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/api/WhatApi/Database/Tables/Place.cs b/api/WhatApi/Database/Tables/Place.cs
new file mode 100644
index 0000000..2914aa7
--- /dev/null
+++ b/api/WhatApi/Database/Tables/Place.cs
@@ -0,0 +1,21 @@
+namespace WhatApi.Database.Tables;
+
+public class Place : BaseAuditableEntity
+{
+ public Guid Id { get; set; }
+ public Guid ContentId { get; set; }
+ public Content Content { get; set; } = null!;
+ public required Point Location { get; set; }
+}
+
+public class PlaceConfiguration : IEntityTypeConfiguration<Place>
+{
+ public void Configure(EntityTypeBuilder<Place> builder) {
+ builder.ToTable("place");
+ builder.HasKey(x => x.Id);
+ builder.Property(x => x.Location).IsRequired();
+ builder.HasOne(x => x.Content);
+ builder.Property(x => x.Location).HasColumnType($"geometry(point,{Constants.Wgs84SpatialReferenceId})");
+ builder.HasIndex(x => x.Location).HasMethod("gist");
+ }
+}