summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Tables/User.cs
blob: 5c068b2158da0273e3d91c3a6d9e8c2641d866ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace WhatApi.Tables;

public class User : IAuditableEntity
{
    public Guid Id { 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");
    }
}