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/Content.cs | |
| parent | 5c59225ee10949cc58fccce4d968d1ede58be9b6 (diff) | |
| download | what-842502e82c4ddfea05a5f77c361aaa27f75afc42.tar.xz what-842502e82c4ddfea05a5f77c361aaa27f75afc42.zip | |
Refactor db schema and add audits
Diffstat (limited to 'api/WhatApi/Tables/Content.cs')
| -rw-r--r-- | api/WhatApi/Tables/Content.cs | 20 |
1 files changed, 16 insertions, 4 deletions
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<Content> +{ + public void Configure(EntityTypeBuilder<Content> builder) { + builder.HasKey(x => x.Id); + builder.Property(x => x.Mime).HasMaxLength(100).IsRequired(); + builder.ToTable("content"); + } }
\ No newline at end of file |
