Person models added

This commit is contained in:
2024-03-20 00:34:47 +01:00
Unverified
parent 0d777344a9
commit a5b7efdff6
17 changed files with 3367 additions and 1 deletions

View File

@@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WatchIt.Database.Model.Account;
namespace WatchIt.Database.Model.Person
{
public class PersonPhotoImage : IEntity<PersonPhotoImage>
{
#region PROPERTIES
public Guid Id { get; set; }
public byte[] Image { get; set; }
public string MimeType { get; set; }
public DateTime UploadDate { get; set; }
#endregion
#region NAVIGATION
public Person Person { get; set; }
#endregion
#region PUBLIC METHODS
static void IEntity<PersonPhotoImage>.Build(EntityTypeBuilder<PersonPhotoImage> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.Property(x => x.Image)
.HasMaxLength(-1)
.IsRequired();
builder.Property(x => x.MimeType)
.HasMaxLength(50)
.IsRequired();
builder.Property(x => x.UploadDate)
.IsRequired()
.HasDefaultValueSql("now()");
}
#endregion
}
}