diff --git a/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs b/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs index f75862f88305781bdd61282571562258c17e6a5a..a4ef70043b6e9151729d096893da58da272b33be 100644 --- a/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs +++ b/Tsi1.Api/Tsi1.BusinessLayer/DataLoad/DataLoad.cs @@ -64,21 +64,34 @@ namespace Tsi1.BusinessLayer.DataLoad public async Task LoadDataAsync() { // TENANTS - var tenants = new List<Tenant> + var newTenants = new List<Tenant> { new Tenant { Name = TenantAdmin.Name, + Theme = "pulse" }, new Tenant { Name = "fing", + Theme = "darkly" }, + new Tenant + { + Name = "fmed", + Theme = "sketchy" + + } }; - _context.Tenants.AddRange(tenants); + _context.Tenants.AddRange(newTenants); await _context.SaveChangesAsync(); + var tenants = await _context.Tenants.ToListAsync(); + var tenantFing = tenants.FirstOrDefault(x => x.Name == "fing"); + var tenantFmed = tenants.FirstOrDefault(x => x.Name == "fmed"); + var tenantAdminId = tenants.FirstOrDefault(x => x.Name == TenantAdmin.Name).Id; + // USER TYPES var udelarAdminUserType = new UserType { @@ -111,33 +124,54 @@ namespace Tsi1.BusinessLayer.DataLoad { new User { + Id = -1, UserTypeId = udelarAdminUserType.Id, Username = "admin", Password = "admin", FirstName = "admin", LastName = "admin", Email = "admin@mail.com", - TenantId = 1, + TenantId = tenantAdminId, }, + // FING new User { + Id = -2, UserTypeId = studentUserType.Id, Username = "enzo", Password = "enzo", FirstName = "Enzo", LastName = "Santangelo", - Email = "enzo@mail.com", + Email = "enzo020895@gmail.com", + Student = new Student + { + TenantId = tenantFing.Id, + IdentityCard = "4932876-0", + }, + TenantId = tenantFing.Id, + }, + + new User + { + Id = -3, + UserTypeId = studentUserType.Id, + Username = "lucca", + Password = "lucca", + FirstName = "Lucca", + LastName = "Santangelo", + Email = "luccasant95@gmail.com", Student = new Student { - TenantId = 2, - IdentityCard = "13242344-5", + TenantId = tenantFing.Id, + IdentityCard = "4932877-6", }, - TenantId = 2, + TenantId = tenantFing.Id, }, new User { + Id = -4, UserTypeId = studentUserType.Id, Username = "mathias", Password = "mathias", @@ -146,37 +180,142 @@ namespace Tsi1.BusinessLayer.DataLoad Email = "mathias@mail.com", Student = new Student { - IdentityCard = "3782346-5", - TenantId = 2, + IdentityCard = "1234567-8", + TenantId = tenantFing.Id, }, - TenantId = 2, + TenantId = tenantFing.Id, }, new User { + Id = -5, UserTypeId = professorUserType.Id, - Username = "prof1", - Password = "prof1", + Username = "jperez", + Password = "jperez", FirstName = "Juan", LastName = "Perez", - Email = "jp@mail.com", + Email = "jperez@mail.com", Professor = new Professor { - TenantId = 2, + Id = -1, + TenantId = tenantFing.Id, IdentityCard = "98754342-5", }, - TenantId = 2, + TenantId = tenantFing.Id, + }, + + new User + { + Id = -6, + UserTypeId = professorUserType.Id, + Username = "csuarez", + Password = "csuarez", + FirstName = "Carlos", + LastName = "Suarez", + Email = "csuarez@mail.com", + Professor = new Professor + { + Id = -2, + TenantId = tenantFing.Id, + IdentityCard = "2133453-5", + }, + TenantId = tenantFing.Id, }, new User { + Id = -7, UserTypeId = facultyAdminUserType.Id, - Username = "fing", - Password = "fing", - FirstName = "fing", - LastName = "fing", - Email = "fing@mail.com", - TenantId = 2, + Username = "lrodriguez", + Password = "lrodriguez", + FirstName = "Luis", + LastName = "Rodriguez", + Email = "lrodriguez@mail.com", + TenantId = tenantFing.Id, + }, + + //FMED + + new User + { + Id = -8, + UserTypeId = studentUserType.Id, + Username = "marcelo", + Password = "rodriguez", + FirstName = "Marcelo", + LastName = "Rodriguez", + Email = "marcelo@gmail.com", + Student = new Student + { + TenantId = tenantFmed.Id, + IdentityCard = "76347887-0", + }, + TenantId = tenantFmed.Id, + }, + + new User + { + Id = -9, + UserTypeId = studentUserType.Id, + Username = "rodrigo", + Password = "sastre", + FirstName = "Rodrigo", + LastName = "Sastre", + Email = "rsastre@gmail.com", + Student = new Student + { + TenantId = tenantFmed.Id, + IdentityCard = "73642873-6", + }, + TenantId = tenantFmed.Id, + }, + + new User + { + Id = -10, + UserTypeId = professorUserType.Id, + Username = "dgonzalez", + Password = "dgonzalez", + FirstName = "Diego", + LastName = "Gonzalez", + Email = "dgonzalez@mail.com", + Professor = new Professor + { + Id = -3, + TenantId = tenantFmed.Id, + IdentityCard = "897349827-5", + }, + TenantId = tenantFmed.Id, + }, + + new User + { + Id = -11, + UserTypeId = professorUserType.Id, + Username = "gfernandez", + Password = "gfernandez", + FirstName = "Guillermo", + LastName = "Fernandez", + Email = "gfernandez@mail.com", + Professor = new Professor + { + Id = -4, + TenantId = tenantFmed.Id, + IdentityCard = "782698091-5", + }, + TenantId = tenantFmed.Id, + }, + + new User + { + Id = -12, + UserTypeId = facultyAdminUserType.Id, + Username = "jsilva", + Password = "jsilva", + FirstName = "Jorge", + LastName = "Silva", + Email = "jsilva@mail.com", + TenantId = tenantFmed.Id, }, }; @@ -213,40 +352,144 @@ namespace Tsi1.BusinessLayer.DataLoad await _context.SaveChangesAsync(); + + // EVALUATION TYPES + var examEvaluationType = new EvaluationType + { + Name = "Exam" + }; + _context.EvaluationTypes.Add(examEvaluationType); + + var laboratoryEvaluationType = new EvaluationType + { + Name = "Laboratory" + }; + _context.EvaluationTypes.Add(laboratoryEvaluationType); + + var midTermEvaluationType = new EvaluationType + { + Name = "MidTerm" + }; + _context.EvaluationTypes.Add(midTermEvaluationType); + + await _context.SaveChangesAsync(); + + // COURSES var courses = new List<Course> { new Course { - Id = 1, + Id = -1, Name = "Calculo 1", - TenantId = 2 + TenantId = tenantFing.Id, + IsPublic = true, + HasPassword = true, + Password = "fing", + }, new Course { - Id = 2, + Id = -2, Name = "GAL 1", - TenantId = 2 + TenantId = tenantFing.Id, + IsPublic = true, }, new Course { - Id = 3, + Id = -3, Name = "Fisica 1", - TenantId = 2 - } + TenantId = tenantFing.Id, + IsPublic = false, + }, + + new Course + { + Id = -11, + Name = "Neurociencias", + TenantId = tenantFmed.Id, + IsPublic = true, + }, + + new Course + { + Id = -21, + Name = "Cardiovascular y Respiratorio", + TenantId = tenantFmed.Id, + IsPublic = false, + HasPassword = true, + Password = "fmed" + }, + }; _context.Courses.AddRange(courses); await _context.SaveChangesAsync(); + // PROFESSOR COURSES + + var professorCourses = new List<ProfessorCourse> + { + new ProfessorCourse + { + CourseId = -1, + ProfessorId = -1, + }, + + new ProfessorCourse + { + CourseId = -2, + ProfessorId = -1, + }, + + new ProfessorCourse + { + CourseId = -3, + ProfessorId = -1, + }, + + new ProfessorCourse + { + CourseId = -1, + ProfessorId = -2, + }, + + new ProfessorCourse + { + CourseId = -2, + ProfessorId = -2, + }, + + new ProfessorCourse + { + CourseId = -11, + ProfessorId = -3, + }, + + new ProfessorCourse + { + CourseId = -21, + ProfessorId = -3, + }, + + new ProfessorCourse + { + CourseId = -11, + ProfessorId = -4, + }, + }; + + _context.ProfessorCourses.AddRange(professorCourses); + + await _context.SaveChangesAsync(); // SECTIONS var section1 = new Section { - CourseId = 1, + CourseId = -1, Name = "General", Order = 1, SectionItems = new List<SectionItem> @@ -269,13 +512,13 @@ namespace Tsi1.BusinessLayer.DataLoad Name = "General" } }, - } + } }; _context.Sections.Add(section1); var section2 = new Section { - CourseId = 2, + CourseId = -2, Name = "General", Order = 1, SectionItems = new List<SectionItem> @@ -296,7 +539,7 @@ namespace Tsi1.BusinessLayer.DataLoad var section3 = new Section { - CourseId = 1, + CourseId = -1, Name = "Tema 1", Order = 2, SectionItems = new List<SectionItem> @@ -314,6 +557,94 @@ namespace Tsi1.BusinessLayer.DataLoad }; _context.Sections.Add(section3); + var section4 = new Section + { + CourseId = -3, + Name = "General", + Order = 1, + SectionItems = new List<SectionItem> + { + new SectionItem + { + Order = 1, + SectionItemTypeId = sectionItemTypeForum.Id, + Forum = new Forum + { + Name = "Novedades" + } + }, + new SectionItem + { + Order = 2, + SectionItemTypeId = sectionItemTypeForum.Id, + Forum = new Forum + { + Name = "General" + } + }, + } + }; + _context.Sections.Add(section4); + + + var section5 = new Section + { + CourseId = -11, + Name = "General", + Order = 1, + SectionItems = new List<SectionItem> + { + new SectionItem + { + Order = 1, + SectionItemTypeId = sectionItemTypeForum.Id, + Forum = new Forum + { + Name = "Novedades" + } + }, + new SectionItem + { + Order = 2, + SectionItemTypeId = sectionItemTypeForum.Id, + Forum = new Forum + { + Name = "General" + } + }, + } + }; + _context.Sections.Add(section5); + + var section6 = new Section + { + CourseId = -21, + Name = "General", + Order = 1, + SectionItems = new List<SectionItem> + { + new SectionItem + { + Order = 1, + SectionItemTypeId = sectionItemTypeForum.Id, + Forum = new Forum + { + Name = "Novedades" + } + }, + new SectionItem + { + Order = 2, + SectionItemTypeId = sectionItemTypeForum.Id, + Forum = new Forum + { + Name = "General" + } + }, + } + }; + _context.Sections.Add(section6); + await _context.SaveChangesAsync(); // ANSWER OPTIONS @@ -344,6 +675,209 @@ namespace Tsi1.BusinessLayer.DataLoad _context.AnswerOptions.AddRange(answerOptions); await _context.SaveChangesAsync(); + + // Actividades + var activities = new List<Activity> + { + new Activity + { + CourseId = -1, + Date = new DateTime(2020, 12, 19), + IsVideoConference = false, + Name = "Primer Parcial", + Evaluation = new Evaluation + { + EvaluationTypeId = midTermEvaluationType.Id, + } + }, + + new Activity + { + CourseId = -1, + Date = new DateTime(2020, 12, 28), + IsVideoConference = false, + Name = "Segundo Parcial", + Evaluation = new Evaluation + { + EvaluationTypeId = midTermEvaluationType.Id, + } + }, + + new Activity + { + CourseId = -2, + Date = new DateTime(2020, 12, 29), + IsVideoConference = false, + Name = "Examen", + Evaluation = new Evaluation + { + EvaluationTypeId = examEvaluationType.Id, + } + }, + + new Activity + { + CourseId = -3, + Date = new DateTime(2020, 12, 27), + IsVideoConference = false, + Name = "Examen", + Evaluation = new Evaluation + { + EvaluationTypeId = examEvaluationType.Id, + } + }, + + new Activity + { + CourseId = -11, + Date = new DateTime(2020, 12, 16), + IsVideoConference = false, + Name = "Primer Parcial", + Evaluation = new Evaluation + { + EvaluationTypeId = midTermEvaluationType.Id, + } + }, + + new Activity + { + CourseId = -11, + Date = new DateTime(2020, 12, 27), + IsVideoConference = false, + Name = "Segundo Parcial", + Evaluation = new Evaluation + { + EvaluationTypeId = midTermEvaluationType.Id, + } + }, + + new Activity + { + CourseId = -21, + Date = new DateTime(2020, 12, 24), + IsVideoConference = false, + Name = "Examen", + Evaluation = new Evaluation + { + EvaluationTypeId = examEvaluationType.Id, + } + }, + + }; + + _context.Activities.AddRange(activities); + await _context.SaveChangesAsync(); + + // SURVEYS + + var surveys = new List<Survey> + { + new Survey + { + IsGlobal = true, + Name = "Encuesta Fing", + Tenant = tenantFing, + SurveyQuestions = new List<SurveyQuestion> + { + new SurveyQuestion + { + Question = "¿Opinión sobre la Facultad de IngenierÃa?" + }, + + new SurveyQuestion + { + Question = "¿Opinion sobre las carreras de grado?" + }, + + new SurveyQuestion + { + Question = "¿Opinion sobre las carreras de posgrado?" + }, + } + }, + + new Survey + { + IsGlobal = true, + Name = "Encuesta Fmed", + Tenant = tenantFmed, + SurveyQuestions = new List<SurveyQuestion> + { + new SurveyQuestion + { + Question = "¿Opinión sobre la Facultad de Medicina?" + }, + + new SurveyQuestion + { + Question = "¿Opinion sobre las carreras de grado?" + }, + + new SurveyQuestion + { + Question = "¿Opinion sobre las carreras de posgrado?" + }, + } + }, + }; + + _context.Surveys.AddRange(surveys); + await _context.SaveChangesAsync(); + + // Communications + + var calculo1 = await _context.Courses.FirstOrDefaultAsync(x => x.Id == -1); + var gal1 = await _context.Courses.FirstOrDefaultAsync(x => x.Id == -2); + var fisica1 = await _context.Courses.FirstOrDefaultAsync(x => x.Id == -3); + var neuroCiencias = await _context.Courses.FirstOrDefaultAsync(x => x.Id == -11); + var cardiovascular = await _context.Courses.FirstOrDefaultAsync(x => x.Id == -21); + + var communications = new List<Communication> + { + new Communication + { + IsGlobal = true, + Tenant = tenantFing, + Text = "La facultad permanecera cerrada el dÃa 25/12/2020" + }, + + new Communication + { + IsGlobal = true, + Tenant = tenantFmed, + Text = "La facultad permanecera cerrada el dÃa 01/01/2021" + }, + + new Communication + { + IsGlobal = false, + Course = calculo1, + Text = "Se suspende la clase del dÃa 22/12/2020" + }, + + new Communication + { + IsGlobal = false, + Course = gal1, + Text = "Se suspende la clase del dÃa 17/12/2020" + }, + + new Communication + { + IsGlobal = false, + Course = neuroCiencias, + Text = "Se suspende la clase del dÃa 26/12/2020" + }, + new Communication + { + IsGlobal = false, + Course = cardiovascular, + Text = "Se suspende la clase del dÃa 23/12/2020" + }, + }; + + _context.Communications.AddRange(communications); + await _context.SaveChangesAsync(); } } } \ No newline at end of file diff --git a/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CourseConfiguration.cs b/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CourseConfiguration.cs index e2b10d20581cee91a0b1e1f03dbb8f3a223362a9..beb0f4b16649ba0599605d34729d533370ab5c98 100644 --- a/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CourseConfiguration.cs +++ b/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/CourseConfiguration.cs @@ -27,7 +27,6 @@ namespace Tsi1.DataLayer.EntityConfiguration .IsRequired(); builder.Property(x => x.Password) - .IsRequired() .HasColumnType("character varying(200)"); builder.HasOne(x => x.Tenant) diff --git a/Tsi1.Api/Tsi1.DataLayer/Migrations/20201213193327_course-password-nullable.Designer.cs b/Tsi1.Api/Tsi1.DataLayer/Migrations/20201213193327_course-password-nullable.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..c3ed98775c652337da4322d6f0cc8576ec290ab2 --- /dev/null +++ b/Tsi1.Api/Tsi1.DataLayer/Migrations/20201213193327_course-password-nullable.Designer.cs @@ -0,0 +1,1125 @@ +// <auto-generated /> +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Tsi1.DataLayer; + +namespace Tsi1.DataLayer.Migrations +{ + [DbContext(typeof(Tsi1Context))] + [Migration("20201213193327_course-password-nullable")] + partial class coursepasswordnullable + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Activity", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("CourseId") + .HasColumnType("integer"); + + b.Property<DateTime>("Date") + .HasColumnType("timestamp without time zone"); + + b.Property<int?>("EvaluationId") + .HasColumnType("integer"); + + b.Property<bool>("IsVideoConference") + .HasColumnType("boolean"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.HasIndex("EvaluationId") + .IsUnique(); + + b.ToTable("Activities"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.AnswerOption", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AnswerOptions"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Attendance", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("ActivityId") + .HasColumnType("integer"); + + b.Property<DateTime>("Date") + .HasColumnType("timestamp without time zone"); + + b.Property<int>("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("UserId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Communication", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int?>("CourseId") + .HasColumnType("integer"); + + b.Property<bool>("IsGlobal") + .HasColumnType("boolean"); + + b.Property<int?>("TenantId") + .HasColumnType("integer"); + + b.Property<string>("Text") + .IsRequired() + .HasColumnType("character varying(1000)"); + + b.Property<DateTime>("ValidUntil") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.HasIndex("TenantId"); + + b.HasIndex("ValidUntil"); + + b.ToTable("Communications"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b => + { + b.Property<string>("ConnectionId") + .HasColumnType("text"); + + b.Property<string>("GroupName") + .HasColumnType("text"); + + b.Property<int>("UserId") + .HasColumnType("integer"); + + b.HasKey("ConnectionId"); + + b.HasIndex("GroupName"); + + b.ToTable("Connections"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Course", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<bool>("HasPassword") + .HasColumnType("boolean"); + + b.Property<bool>("IsPublic") + .HasColumnType("boolean"); + + b.Property<bool>("IsTemplate") + .HasColumnType("boolean"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.Property<string>("Password") + .HasColumnType("character varying(200)"); + + b.Property<int>("TenantId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("Name", "TenantId") + .IsUnique(); + + b.ToTable("Courses"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Evaluation", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("EvaluationTypeId") + .HasColumnType("integer"); + + b.Property<bool>("IsCompleted") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("EvaluationTypeId"); + + b.ToTable("Evaluations"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.EvaluationInscription", b => + { + b.Property<int>("EvaluationId") + .HasColumnType("integer"); + + b.Property<int>("StudentId") + .HasColumnType("integer"); + + b.Property<decimal>("Grade") + .HasColumnType("decimal(5,2)"); + + b.Property<bool>("HasAttended") + .HasColumnType("boolean"); + + b.HasKey("EvaluationId", "StudentId"); + + b.HasIndex("StudentId"); + + b.ToTable("EvaluationInscriptions"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.EvaluationType", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("EvaluationTypes"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.File", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<bool>("IsSubmission") + .HasColumnType("boolean"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.Property<string>("Path") + .IsRequired() + .HasColumnType("character varying(1000)"); + + b.Property<int?>("SubmissionId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("Path") + .IsUnique(); + + b.HasIndex("SubmissionId") + .IsUnique(); + + b.ToTable("Files"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Forum", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<bool>("IsAutomaticSubscription") + .HasColumnType("boolean"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("Forums"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.ForumUser", b => + { + b.Property<int>("ForumId") + .HasColumnType("integer"); + + b.Property<int>("UserId") + .HasColumnType("integer"); + + b.HasKey("ForumId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("ForumUsers"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Group", b => + { + b.Property<string>("Name") + .HasColumnType("text"); + + b.HasKey("Name"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Post", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<DateTime>("Date") + .HasColumnType("timestamp without time zone"); + + b.Property<int>("ForumId") + .HasColumnType("integer"); + + b.Property<string>("Title") + .IsRequired() + .HasColumnType("character varying(100)"); + + b.Property<int>("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("ForumId", "Title") + .IsUnique(); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.PostMessage", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("Content") + .IsRequired() + .HasColumnType("character varying(10485760)"); + + b.Property<DateTime>("Date") + .HasColumnType("timestamp without time zone"); + + b.Property<int>("PostId") + .HasColumnType("integer"); + + b.Property<int>("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PostId"); + + b.HasIndex("UserId"); + + b.ToTable("PostMessages"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Professor", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("IdentityCard") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.Property<int>("TenantId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("IdentityCard", "TenantId") + .IsUnique(); + + b.ToTable("Professors"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.ProfessorCourse", b => + { + b.Property<int>("ProfessorId") + .HasColumnType("integer"); + + b.Property<int>("CourseId") + .HasColumnType("integer"); + + b.HasKey("ProfessorId", "CourseId"); + + b.HasIndex("CourseId"); + + b.ToTable("ProfessorCourses"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Section", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("CourseId") + .HasColumnType("integer"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<int>("Order") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.ToTable("Sections"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SectionItem", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int?>("FileId") + .HasColumnType("integer"); + + b.Property<int?>("ForumId") + .HasColumnType("integer"); + + b.Property<int>("Order") + .HasColumnType("integer"); + + b.Property<int>("SectionId") + .HasColumnType("integer"); + + b.Property<int>("SectionItemTypeId") + .HasColumnType("integer"); + + b.Property<int?>("SurveyId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("FileId") + .IsUnique(); + + b.HasIndex("ForumId") + .IsUnique(); + + b.HasIndex("SectionId"); + + b.HasIndex("SectionItemTypeId"); + + b.HasIndex("SurveyId") + .IsUnique(); + + b.ToTable("SectionItems"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SectionItemType", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(100)"); + + b.HasKey("Id"); + + b.ToTable("SectionItemTypes"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Student", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("IdentityCard") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.Property<int>("TenantId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("IdentityCard", "TenantId") + .IsUnique(); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourse", b => + { + b.Property<int>("StudentId") + .HasColumnType("integer"); + + b.Property<int>("CourseId") + .HasColumnType("integer"); + + b.HasKey("StudentId", "CourseId"); + + b.HasIndex("CourseId"); + + b.ToTable("StudentCourses"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourseResult", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("CourseId") + .HasColumnType("integer"); + + b.Property<DateTime>("Date") + .HasColumnType("timestamp without time zone"); + + b.Property<int>("Result") + .HasColumnType("integer"); + + b.Property<int>("StudentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CourseId"); + + b.HasIndex("StudentId"); + + b.ToTable("StudentCourseResults"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Submission", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int?>("EvaluationId") + .HasColumnType("integer"); + + b.Property<int>("FileId") + .HasColumnType("integer"); + + b.Property<decimal>("Grade") + .HasColumnType("decimal(5,2)"); + + b.Property<bool>("IsCompleted") + .HasColumnType("boolean"); + + b.Property<int>("StudentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("EvaluationId"); + + b.HasIndex("StudentId", "FileId") + .IsUnique(); + + b.ToTable("Submissions"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Survey", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<bool>("IsGlobal") + .HasColumnType("boolean"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<int?>("TenantId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.HasIndex("TenantId"); + + b.ToTable("Surveys"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyAnswer", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("AnswerOptionId") + .HasColumnType("integer"); + + b.Property<int>("SurveyQuestionId") + .HasColumnType("integer"); + + b.Property<int>("SurveyResponseId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AnswerOptionId"); + + b.HasIndex("SurveyQuestionId"); + + b.HasIndex("SurveyResponseId"); + + b.ToTable("SurveyAnswers"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyQuestion", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("Question") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<int>("SurveyId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("SurveyId"); + + b.ToTable("SurveyQuestions"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyResponse", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<int>("SurveyId") + .HasColumnType("integer"); + + b.Property<int>("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("SurveyId"); + + b.HasIndex("UserId"); + + b.ToTable("SurveyResponses"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Tenant", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<bool>("IsLoginBedelia") + .HasColumnType("boolean"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.Property<string>("Theme") + .IsRequired() + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Tenants"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.User", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<DateTime>("Birthdate") + .HasColumnType("timestamp without time zone"); + + b.Property<string>("Email") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<string>("FirstName") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<string>("LastName") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<string>("Password") + .IsRequired() + .HasColumnType("character varying(255)"); + + b.Property<int?>("ProfessorId") + .HasColumnType("integer"); + + b.Property<int?>("StudentId") + .HasColumnType("integer"); + + b.Property<int>("TenantId") + .HasColumnType("integer"); + + b.Property<int>("UserTypeId") + .HasColumnType("integer"); + + b.Property<string>("Username") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("ProfessorId") + .IsUnique(); + + b.HasIndex("StudentId") + .IsUnique(); + + b.HasIndex("TenantId"); + + b.HasIndex("UserTypeId"); + + b.HasIndex("Username", "TenantId") + .IsUnique(); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.UserType", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("UserTypes"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Activity", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Course", "Course") + .WithMany("Activities") + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.Evaluation", "Evaluation") + .WithOne("Activity") + .HasForeignKey("Tsi1.DataLayer.Entities.Activity", "EvaluationId"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Attendance", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Activity", "Activity") + .WithMany("Attendances") + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.User", "User") + .WithMany("Attendances") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Communication", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Course", "Course") + .WithMany("Communications") + .HasForeignKey("CourseId"); + + b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant") + .WithMany("Communications") + .HasForeignKey("TenantId"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Connection", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Group", "Group") + .WithMany("Connections") + .HasForeignKey("GroupName"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Course", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant") + .WithMany("Courses") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Evaluation", b => + { + b.HasOne("Tsi1.DataLayer.Entities.EvaluationType", "EvaluationType") + .WithMany() + .HasForeignKey("EvaluationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.EvaluationInscription", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Evaluation", "Evaluation") + .WithMany("EvaluationInscriptions") + .HasForeignKey("EvaluationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.Student", "Student") + .WithMany("EvaluationInscriptions") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.File", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Submission", "Submission") + .WithOne("File") + .HasForeignKey("Tsi1.DataLayer.Entities.File", "SubmissionId"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.ForumUser", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Forum", "Forum") + .WithMany("ForumUsers") + .HasForeignKey("ForumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.User", "User") + .WithMany("ForumUsers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Post", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Forum", "Forum") + .WithMany("Posts") + .HasForeignKey("ForumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.User", "User") + .WithMany("Posts") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.PostMessage", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Post", "Post") + .WithMany("PostMessages") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.User", "User") + .WithMany("PostMessages") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Professor", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant") + .WithMany("Professors") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.ProfessorCourse", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Course", "Course") + .WithMany("ProfessorCourses") + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.Professor", "Professor") + .WithMany("ProfessorCourses") + .HasForeignKey("ProfessorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Section", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Course", "Course") + .WithMany("Sections") + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SectionItem", b => + { + b.HasOne("Tsi1.DataLayer.Entities.File", "File") + .WithOne("SectionItem") + .HasForeignKey("Tsi1.DataLayer.Entities.SectionItem", "FileId"); + + b.HasOne("Tsi1.DataLayer.Entities.Forum", "Forum") + .WithOne("SectionItem") + .HasForeignKey("Tsi1.DataLayer.Entities.SectionItem", "ForumId"); + + b.HasOne("Tsi1.DataLayer.Entities.Section", "Section") + .WithMany("SectionItems") + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.SectionItemType", "SectionItemType") + .WithMany("SectionItems") + .HasForeignKey("SectionItemTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.Survey", "Survey") + .WithOne("SectionItem") + .HasForeignKey("Tsi1.DataLayer.Entities.SectionItem", "SurveyId"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Student", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant") + .WithMany("Students") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourse", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Course", "Course") + .WithMany("StudentCourses") + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.Student", "Student") + .WithMany("StudentCourses") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.StudentCourseResult", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Course", "Course") + .WithMany("StudentCourseResults") + .HasForeignKey("CourseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.Student", "Student") + .WithMany("StudentCourseResults") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Submission", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Evaluation", null) + .WithMany("Submissions") + .HasForeignKey("EvaluationId"); + + b.HasOne("Tsi1.DataLayer.Entities.Student", "Student") + .WithMany("Submissions") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.Survey", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant") + .WithMany("Surveys") + .HasForeignKey("TenantId"); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyAnswer", b => + { + b.HasOne("Tsi1.DataLayer.Entities.AnswerOption", "AnswerOption") + .WithMany("SurveyAnswers") + .HasForeignKey("AnswerOptionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.SurveyQuestion", "SurveyQuestion") + .WithMany("SurveyAnswers") + .HasForeignKey("SurveyQuestionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.SurveyResponse", "SurveyResponse") + .WithMany("SurveyAnswers") + .HasForeignKey("SurveyResponseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyQuestion", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Survey", "Survey") + .WithMany("SurveyQuestions") + .HasForeignKey("SurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.SurveyResponse", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Survey", "Survey") + .WithMany("SurveyResponses") + .HasForeignKey("SurveyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.User", "User") + .WithMany("SurveyResponses") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Tsi1.DataLayer.Entities.User", b => + { + b.HasOne("Tsi1.DataLayer.Entities.Professor", "Professor") + .WithOne("User") + .HasForeignKey("Tsi1.DataLayer.Entities.User", "ProfessorId"); + + b.HasOne("Tsi1.DataLayer.Entities.Student", "Student") + .WithOne("User") + .HasForeignKey("Tsi1.DataLayer.Entities.User", "StudentId"); + + b.HasOne("Tsi1.DataLayer.Entities.Tenant", "Tenant") + .WithMany("Users") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Tsi1.DataLayer.Entities.UserType", "UserType") + .WithMany() + .HasForeignKey("UserTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Tsi1.Api/Tsi1.DataLayer/Migrations/20201213193327_course-password-nullable.cs b/Tsi1.Api/Tsi1.DataLayer/Migrations/20201213193327_course-password-nullable.cs new file mode 100644 index 0000000000000000000000000000000000000000..b9d8a32179e31e90214777179a5b3a61d0b5f4f1 --- /dev/null +++ b/Tsi1.Api/Tsi1.DataLayer/Migrations/20201213193327_course-password-nullable.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Tsi1.DataLayer.Migrations +{ + public partial class coursepasswordnullable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn<string>( + name: "Password", + table: "Courses", + type: "character varying(200)", + nullable: true, + oldClrType: typeof(string), + oldType: "character varying(200)"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn<string>( + name: "Password", + table: "Courses", + type: "character varying(200)", + nullable: false, + oldClrType: typeof(string), + oldType: "character varying(200)", + oldNullable: true); + } + } +} diff --git a/Tsi1.Api/Tsi1.DataLayer/Migrations/Tsi1ContextModelSnapshot.cs b/Tsi1.Api/Tsi1.DataLayer/Migrations/Tsi1ContextModelSnapshot.cs index 95b584be9cf6c6fa1fb958d43401fb75b4fd80b2..ec4e3d97abdfc6b5d9d8c883c47b9f8f28231c8a 100644 --- a/Tsi1.Api/Tsi1.DataLayer/Migrations/Tsi1ContextModelSnapshot.cs +++ b/Tsi1.Api/Tsi1.DataLayer/Migrations/Tsi1ContextModelSnapshot.cs @@ -168,7 +168,6 @@ namespace Tsi1.DataLayer.Migrations .HasColumnType("character varying(50)"); b.Property<string>("Password") - .IsRequired() .HasColumnType("character varying(200)"); b.Property<int>("TenantId")