summaryrefslogtreecommitdiffstats
path: root/api/WhatApi/Tables/Content.cs
blob: 0b26b8269765cc6e8220067da29ac319b23f3b9f (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
using System.Net;

namespace WhatApi.Tables;

public class Content : IAuditableEntity
{
    public Guid Id { get; set; }
    public required string Mime { get; set; }
    public Guid BlobId { 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");
    }
}