mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add document roles.
This commit is contained in:
15
Cicm.Database/Models/DocumentRole.cs
Normal file
15
Cicm.Database/Models/DocumentRole.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Cicm.Database.Models
|
||||
{
|
||||
public class DocumentRole
|
||||
{
|
||||
[Column(TypeName = "char(3)")]
|
||||
[Key]
|
||||
[Required]
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<Person> People { get; set; }
|
||||
public virtual DbSet<Iso639> Iso639 { get; set; }
|
||||
public virtual DbSet<Document> Documents { get; set; }
|
||||
public virtual DbSet<DocumentRole> DocumentRoles { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
@@ -275,6 +276,15 @@ namespace Cicm.Database.Models
|
||||
entity.HasOne(d => d.Country).WithMany(p => p.Documents).HasForeignKey(d => d.CountryId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentRole>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Name);
|
||||
|
||||
entity.HasIndex(e => e.Enabled);
|
||||
|
||||
entity.Property(p => p.Enabled).HasDefaultValue(true);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Forbidden>(entity =>
|
||||
{
|
||||
entity.ToTable("forbidden");
|
||||
@@ -1193,6 +1203,7 @@ namespace Cicm.Database.Models
|
||||
});
|
||||
|
||||
Seeders.License.Seed(modelBuilder);
|
||||
Seeders.DocumentRoles.Seed(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user