diff --git a/Tsi1.Api/Tsi1.DataLayer/Entities/Communication.cs b/Tsi1.Api/Tsi1.DataLayer/Entities/Communication.cs new file mode 100644 index 0000000000000000000000000000000000000000..c8d5dec608ab052d139251173ce2f65dc1c0f46e --- /dev/null +++ b/Tsi1.Api/Tsi1.DataLayer/Entities/Communication.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tsi1.DataLayer.Entities +{ + public class Communication + { + public int Id { get; set; } + + public string Text { get; set; } + + public DateTime ValidUntil { get; set; } + + public Course Course { get; set; } + + public Tenant Tenant { get; set; } + } +} diff --git a/Tsi1.Api/Tsi1.DataLayer/Entities/Course.cs b/Tsi1.Api/Tsi1.DataLayer/Entities/Course.cs index 80c429198380aaf675c92b39bd57261dbda4fc5e..f7efedf6afcfa34052001aa393799e23773d8eb3 100644 --- a/Tsi1.Api/Tsi1.DataLayer/Entities/Course.cs +++ b/Tsi1.Api/Tsi1.DataLayer/Entities/Course.cs @@ -11,6 +11,7 @@ namespace Tsi1.DataLayer.Entities StudentCourses = new HashSet<StudentCourse>(); ProfessorCourses = new HashSet<ProfessorCourse>(); Sections = new HashSet<Section>(); + Communications = new HashSet<Communication>(); } public int Id { get; set; } @@ -22,5 +23,7 @@ namespace Tsi1.DataLayer.Entities public ICollection<StudentCourse> StudentCourses { get; set; } public ICollection<ProfessorCourse> ProfessorCourses { get; set; } public ICollection<Section> Sections { get; set; } + + public ICollection<Communication> Communications { get; set; } } } diff --git a/Tsi1.Api/Tsi1.DataLayer/Entities/Tenant.cs b/Tsi1.Api/Tsi1.DataLayer/Entities/Tenant.cs index 0a153f83884dc7a09793b79647cb6dc174309b54..a146909738b7f82989d3e8b541bcad8996e89cc6 100644 --- a/Tsi1.Api/Tsi1.DataLayer/Entities/Tenant.cs +++ b/Tsi1.Api/Tsi1.DataLayer/Entities/Tenant.cs @@ -13,6 +13,7 @@ namespace Tsi1.DataLayer.Entities Students = new HashSet<Student>(); Users = new HashSet<User>(); Surveys = new HashSet<Survey>(); + Communications = new HashSet<Communication>(); } public int Id { get; set; } @@ -24,5 +25,7 @@ namespace Tsi1.DataLayer.Entities public ICollection<Student> Students { get; set; } public ICollection<User> Users { get; set; } public ICollection<Survey> Surveys { get; set; } + + public ICollection<Communication> Communications { get; set; } } } diff --git a/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CommunicationConfiguration.cs b/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CommunicationConfiguration.cs new file mode 100644 index 0000000000000000000000000000000000000000..ae75b956b610fbb58fd31143f68d4d9758379252 --- /dev/null +++ b/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CommunicationConfiguration.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Text; +using Tsi1.DataLayer.Entities; + +namespace Tsi1.DataLayer.EntityConfiguration +{ + public class CommunicationConfiguration : IEntityTypeConfiguration<Communication> + { + public void Configure(EntityTypeBuilder<Communication> builder) + { + builder.HasKey(x => x.Id); + + builder.Property(x => x.Text) + .IsRequired() + .HasColumnType("character varying(1000)"); + + builder.Property(x => x.ValidUntil) + .IsRequired(); + + builder.HasIndex(x => x.ValidUntil); + } + } +}