From 842502e82c4ddfea05a5f77c361aaa27f75afc42 Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 26 Oct 2025 22:57:28 +0100 Subject: Refactor db schema and add audits --- api/WhatApi/Tables/Content.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'api/WhatApi/Tables/Content.cs') diff --git a/api/WhatApi/Tables/Content.cs b/api/WhatApi/Tables/Content.cs index 79f2579..0b26b82 100644 --- a/api/WhatApi/Tables/Content.cs +++ b/api/WhatApi/Tables/Content.cs @@ -2,11 +2,23 @@ using System.Net; namespace WhatApi.Tables; -public class Content +public class Content : IAuditableEntity { public Guid Id { get; set; } - public string Mime { get; set; } - public DateTime Created { get; set; } + public required string Mime { get; set; } public Guid BlobId { get; set; } - public IPAddress Ip { get; set; } + public required IPAddress Ip { get; set; } + public DateTimeOffset CreatedAtUtc { get; set; } + public DateTimeOffset? UpdatedAtUtc { get; set; } + public Guid CreatedBy { get; set; } + public Guid? UpdatedBy { get; set; } +} + +public class ContentConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) { + builder.HasKey(x => x.Id); + builder.Property(x => x.Mime).HasMaxLength(100).IsRequired(); + builder.ToTable("content"); + } } \ No newline at end of file -- cgit v1.3