mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Merge branch 'master' into database_fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
@@ -9,7 +10,8 @@ namespace Cicm.Database.Models
|
||||
public string Name { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
|
||||
public virtual Company Company { get; set; }
|
||||
[DisplayName("Linked company")]
|
||||
public virtual Company Company { get; set; }
|
||||
public virtual ICollection<CompaniesByDocument> Documents { get; set; }
|
||||
public virtual ICollection<CompaniesByBook> Books { get; set; }
|
||||
public virtual ICollection<CompaniesByMagazine> Magazines { get; set; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -9,15 +10,20 @@ namespace Cicm.Database.Models
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public string Surname { get; set; }
|
||||
public int? PersonId { get; set; }
|
||||
public string Surname { get; set; }
|
||||
public int? PersonId { get; set; }
|
||||
public string Alias { get; set; }
|
||||
[DisplayName("Name to be displayed")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public virtual Person Person { get; set; }
|
||||
[NotMapped]
|
||||
[DisplayName("Name")]
|
||||
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
|
||||
|
||||
[DisplayName("Linked person")]
|
||||
public virtual Person Person { get; set; }
|
||||
public virtual ICollection<PeopleByDocument> Documents { get; set; }
|
||||
public virtual ICollection<PeopleByBook> Books { get; set; }
|
||||
public virtual ICollection<PeopleByMagazine> Magazines { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FullName => $"{Name} {Surname}";
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
@@ -10,18 +12,29 @@ namespace Cicm.Database.Models
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public string Surname { get; set; }
|
||||
public virtual Iso31661Numeric CountryOfBirth { get; set; }
|
||||
public DateTime BirthDate { get; set; }
|
||||
public DateTime? DeathDate { get; set; }
|
||||
public string Webpage { get; set; }
|
||||
public string Twitter { get; set; }
|
||||
public string Facebook { get; set; }
|
||||
public Guid Photo { get; set; }
|
||||
public int? DocumentPersonId { get; set; }
|
||||
public string Surname { get; set; }
|
||||
[DisplayName("Country of birth")]
|
||||
public virtual Iso31661Numeric CountryOfBirth { get; set; }
|
||||
[DisplayName("Birth date")]
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime BirthDate { get; set; }
|
||||
[DisplayName("Date of death")]
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? DeathDate { get; set; }
|
||||
[Url]
|
||||
public string Webpage { get; set; }
|
||||
[Remote("VerifyTwitter", "People", "Admin")]
|
||||
public string Twitter { get; set; }
|
||||
public string Facebook { get; set; }
|
||||
public Guid Photo { get; set; }
|
||||
public int? DocumentPersonId { get; set; }
|
||||
public string Alias { get; set; }
|
||||
[DisplayName("Name to be displayed")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FullName => $"{Name} {Surname}";
|
||||
[DisplayName("Name")]
|
||||
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
|
||||
|
||||
public short? CountryOfBirthId { get; set; }
|
||||
public virtual ICollection<PeopleByCompany> Companies { get; set; }
|
||||
|
||||
@@ -388,9 +388,6 @@ namespace Cicm.Database.Models
|
||||
entity.HasIndex(e => e.Name);
|
||||
|
||||
entity.HasIndex(e => e.CompanyId).IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Company).WithOne(p => p.DocumentCompany)
|
||||
.HasForeignKey<Company>(d => d.DocumentCompanyId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentPerson>(entity =>
|
||||
@@ -401,6 +398,10 @@ namespace Cicm.Database.Models
|
||||
|
||||
entity.HasIndex(e => e.PersonId).IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.Alias);
|
||||
|
||||
entity.HasIndex(e => e.DisplayName);
|
||||
|
||||
entity.HasOne(d => d.Person).WithOne(p => p.DocumentPerson)
|
||||
.HasForeignKey<Person>(d => d.DocumentPersonId).OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
@@ -1079,6 +1080,10 @@ namespace Cicm.Database.Models
|
||||
|
||||
entity.HasIndex(e => e.Photo);
|
||||
|
||||
entity.HasIndex(e => e.Alias);
|
||||
|
||||
entity.HasIndex(e => e.DisplayName);
|
||||
|
||||
entity.HasOne(d => d.CountryOfBirth).WithMany(p => p.People).HasForeignKey(d => d.CountryOfBirthId);
|
||||
|
||||
entity.HasOne(d => d.DocumentPerson).WithOne(p => p.Person)
|
||||
|
||||
Reference in New Issue
Block a user