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/User.cs | |
| parent | 5c59225ee10949cc58fccce4d968d1ede58be9b6 (diff) | |
| download | what-842502e82c4ddfea05a5f77c361aaa27f75afc42.tar.xz what-842502e82c4ddfea05a5f77c361aaa27f75afc42.zip | |
Refactor db schema and add audits
Diffstat (limited to 'api/WhatApi/Tables/User.cs')
| -rw-r--r-- | api/WhatApi/Tables/User.cs | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/api/WhatApi/Tables/User.cs b/api/WhatApi/Tables/User.cs index 0ebe9b6..5c068b2 100644 --- a/api/WhatApi/Tables/User.cs +++ b/api/WhatApi/Tables/User.cs @@ -1,12 +1,27 @@ namespace WhatApi.Tables; -public class User +public class User : IAuditableEntity { public Guid Id { get; set; } - public string Name { get; set; } - public string Email { get; set; } - public string Password { get; set; } - public DateTime Created { get; set; } - public DateTime? LastSeen { get; set; } - public IEnumerable<Place> Places { get; set; } + public required string Name { get; set; } + public required string Email { get; set; } + public required string Password { get; set; } + public DateTimeOffset? LastSeen { get; set; } + public IEnumerable<Place> Places { get; set; } = null!; + public DateTimeOffset CreatedAtUtc { get; set; } + public DateTimeOffset? UpdatedAtUtc { get; set; } + public Guid CreatedBy { get; set; } + public Guid? UpdatedBy { get; set; } +} + +public class UserConfiguration : IEntityTypeConfiguration<User> +{ + + public void Configure(EntityTypeBuilder<User> builder) { + builder.HasKey(x => x.Id); + builder.Property(x => x.Name).HasMaxLength(50); + builder.Property(x => x.Email).HasMaxLength(100); + builder.HasMany(x => x.Places); + builder.ToTable("user"); + } }
\ No newline at end of file |
