mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add people by company entity.
This commit is contained in:
@@ -90,6 +90,7 @@ namespace Cicm.Database.Models
|
||||
public virtual ICollection<Machine> Machines { get; set; }
|
||||
public virtual ICollection<Processor> Processors { get; set; }
|
||||
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
||||
public virtual ICollection<PeopleByCompany> People { get; set; }
|
||||
public virtual CompanyLogo LastLogo =>
|
||||
Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
|
||||
|
||||
|
||||
17
Cicm.Database/Models/PeopleByCompany.cs
Normal file
17
Cicm.Database/Models/PeopleByCompany.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class PeopleByCompany : BaseModel<long>
|
||||
{
|
||||
public int PersonId { get; set; }
|
||||
public int CompanyId { get; set; }
|
||||
public string Position { get; set; }
|
||||
public DateTime? Start { get; set; }
|
||||
public DateTime? End { get; set; }
|
||||
public bool Ongoing { get; set; }
|
||||
|
||||
public virtual Person Person { get; set; }
|
||||
public virtual Company Company { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -22,5 +23,6 @@ namespace Cicm.Database.Models
|
||||
public string FullName => $"{Name} {Surname}";
|
||||
|
||||
public short? CountryOfBirthId { get; set; }
|
||||
public virtual ICollection<PeopleByCompany> Companies { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -776,6 +776,23 @@ namespace Cicm.Database.Models
|
||||
entity.Property(e => e.Type).HasColumnName("type").HasColumnType("int(11)").HasDefaultValueSql("'0'");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PeopleByCompany>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.PersonId);
|
||||
|
||||
entity.HasIndex(e => e.CompanyId);
|
||||
|
||||
entity.HasIndex(e => e.Position);
|
||||
|
||||
entity.HasIndex(e => e.Start);
|
||||
|
||||
entity.HasIndex(e => e.End);
|
||||
|
||||
entity.HasOne(d => d.Person).WithMany(p => p.Companies).HasForeignKey(d => d.PersonId);
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.People).HasForeignKey(d => d.CompanyId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Person>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Name);
|
||||
|
||||
Reference in New Issue
Block a user