diff options
| author | ivar <i@oiee.no> | 2025-10-26 22:57:28 +0100 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2025-10-26 22:57:28 +0100 |
| commit | 842502e82c4ddfea05a5f77c361aaa27f75afc42 (patch) | |
| tree | 70fe96cd88600224257b80569015008626e3d317 /api/WhatApi/Tables/Place.cs | |
| parent | 5c59225ee10949cc58fccce4d968d1ede58be9b6 (diff) | |
| download | what-842502e82c4ddfea05a5f77c361aaa27f75afc42.tar.xz what-842502e82c4ddfea05a5f77c361aaa27f75afc42.zip | |
Refactor db schema and add audits
Diffstat (limited to 'api/WhatApi/Tables/Place.cs')
| -rw-r--r-- | api/WhatApi/Tables/Place.cs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/api/WhatApi/Tables/Place.cs b/api/WhatApi/Tables/Place.cs index ff95c96..abbd71a 100644 --- a/api/WhatApi/Tables/Place.cs +++ b/api/WhatApi/Tables/Place.cs @@ -1,11 +1,25 @@ -using NetTopologySuite.Geometries; - namespace WhatApi.Tables; -public class Place +public class Place : IAuditableEntity { public Guid Id { get; set; } public Guid ContentId { get; set; } - public Content Content { get; set; } + public Content Content { get; set; } = null!; public required Point Location { get; set; } + public DateTimeOffset CreatedAtUtc { get; set; } + public DateTimeOffset? UpdatedAtUtc { get; set; } + public Guid CreatedBy { get; set; } + public Guid? UpdatedBy { 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"); + } }
\ No newline at end of file |
