summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Tables/AuditTrail.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/Tables/AuditTrail.cs
parent5bd9ad8bd1740dcff179d66718532086304ca4c4 (diff)
downloadwhat-cd70f54266d708867a1eb35870bc755bc5b2df32.tar.xz
what-cd70f54266d708867a1eb35870bc755bc5b2df32.zip
Refactor db
Diffstat (limited to 'api/WhatApi/Tables/AuditTrail.cs')
-rw-r--r--api/WhatApi/Tables/AuditTrail.cs39
1 files changed, 0 insertions, 39 deletions
diff --git a/api/WhatApi/Tables/AuditTrail.cs b/api/WhatApi/Tables/AuditTrail.cs
deleted file mode 100644
index 9613af4..0000000
--- a/api/WhatApi/Tables/AuditTrail.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace WhatApi.Tables;
-
-public class AuditTrail
-{
- public Guid Id { get; init; }
- public Guid? UserId { get; init; }
- public required string EntityName { get; init; }
- public string? PrimaryKey { get; set; }
- public TrailType TrailType { get; set; }
- public DateTimeOffset DateUtc { get; init; }
-
- public Dictionary<string, object?> OldValues { get; init; } = [];
- public Dictionary<string, object?> NewValues { get; init; } = [];
- public List<string> ChangedColumns { get; init; } = [];
-}
-
-public class AuditTrailConfiguration : IEntityTypeConfiguration<AuditTrail>
-{
- public void Configure(EntityTypeBuilder<AuditTrail> builder)
- {
- builder.ToTable("audit_trails");
- builder.HasIndex(e => e.EntityName);
- builder.Property(e => e.EntityName).HasMaxLength(100).IsRequired();
- builder.Property(e => e.PrimaryKey).HasMaxLength(100);
- builder.Property(e => e.DateUtc).IsRequired();
- builder.Property(e => e.TrailType).HasConversion<string>();
- builder.Property(e => e.OldValues).HasColumnType("jsonb");
- builder.Property(e => e.NewValues).HasColumnType("jsonb");
- builder.Property(e => e.ChangedColumns).HasColumnType("jsonb");
- }
-}
-
-public enum TrailType : byte
-{
- None = 0,
- Create = 1,
- Update = 2,
- Delete = 3
-} \ No newline at end of file