XDDDEEEE
This commit is contained in:
parent
29e4928a73
commit
ccc9243704
@ -12,7 +12,7 @@ namespace InternshipSystem.Api.Commands
|
|||||||
public DateTime? Start { get; set; }
|
public DateTime? Start { get; set; }
|
||||||
public DateTime? End { get; set; }
|
public DateTime? End { get; set; }
|
||||||
public UpdateMentor? Mentor { get; set; }
|
public UpdateMentor? Mentor { get; set; }
|
||||||
public List<Internship> Subjects { get; set; }
|
public List<long> Subjects { get; set; }
|
||||||
public InternshipType Type { get; set; }
|
public InternshipType Type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,10 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
.Where(i => i.Student.Id == user.PersonNumber)
|
.Where(i => i.Student.Id == user.PersonNumber)
|
||||||
.Select(i => i.InternshipRegistration)
|
.Select(i => i.InternshipRegistration)
|
||||||
.Include(r => r.BranchAddress)
|
.Include(r => r.BranchAddress)
|
||||||
|
.Include(r => r.Type)
|
||||||
|
.Include(r => r.Subjects)
|
||||||
.Include(r => r.Company)
|
.Include(r => r.Company)
|
||||||
.ThenInclude(c => c.Branches)
|
.Include(r => r.Company.Branches)
|
||||||
.FirstAsync(cancellationToken);
|
.FirstAsync(cancellationToken);
|
||||||
|
|
||||||
var useCase = new UpdateInternshipRegistrationUseCase(_context, internshipRegistration, edition, user);
|
var useCase = new UpdateInternshipRegistrationUseCase(_context, internshipRegistration, edition, user);
|
||||||
@ -82,7 +84,6 @@ namespace InternshipSystem.Api.Controllers
|
|||||||
.Include(i => i.InternshipRegistration.Company)
|
.Include(i => i.InternshipRegistration.Company)
|
||||||
.Include(i => i.InternshipRegistration.BranchAddress)
|
.Include(i => i.InternshipRegistration.BranchAddress)
|
||||||
.Include(i => i.InternshipRegistration.Type)
|
.Include(i => i.InternshipRegistration.Type)
|
||||||
.Include(i => i.InternshipProgram)
|
|
||||||
.Include(i => i.Report)
|
.Include(i => i.Report)
|
||||||
.Include(i => i.Approvals)
|
.Include(i => i.Approvals)
|
||||||
.Include(i => i.Documentation)
|
.Include(i => i.Documentation)
|
||||||
|
@ -109,14 +109,14 @@ namespace InternshipSystem.Api.UseCases
|
|||||||
subjectRegistration.Company = company;
|
subjectRegistration.Company = company;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSubjects(IEnumerable<Internship> subjects)
|
private void UpdateSubjects(IEnumerable<long> subjects)
|
||||||
{
|
{
|
||||||
subjectRegistration.Subjects =
|
subjectRegistration.Subjects =
|
||||||
subjects
|
subjects
|
||||||
.Select(i => new ProgramSubject
|
.Select(i => new ProgramSubject
|
||||||
{
|
{
|
||||||
Registration = subjectRegistration,
|
Registration = subjectRegistration,
|
||||||
InternshipSubjectId = i.Id
|
InternshipSubjectId = i
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ namespace InternshipSystem.Core
|
|||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
public Student Student { get; set; }
|
public Student Student { get; set; }
|
||||||
public InternshipRegistration InternshipRegistration { get; set; }
|
public InternshipRegistration InternshipRegistration { get; set; }
|
||||||
public InternshipProgram InternshipProgram { get; set; }
|
|
||||||
public Report Report { get; set; }
|
public Report Report { get; set; }
|
||||||
public List<Document> Approvals { get; set; }
|
public List<Document> Approvals { get; set; }
|
||||||
public List<Document> Documentation { get; set; }
|
public List<Document> Documentation { get; set; }
|
||||||
@ -43,7 +42,6 @@ namespace InternshipSystem.Core
|
|||||||
internship.Student = student;
|
internship.Student = student;
|
||||||
|
|
||||||
internship.InternshipRegistration = InternshipRegistration.Create();
|
internship.InternshipRegistration = InternshipRegistration.Create();
|
||||||
internship.InternshipProgram = InternshipProgram.Create();
|
|
||||||
internship.Report = Report.Create();
|
internship.Report = Report.Create();
|
||||||
internship.Approvals = new List<Document>();
|
internship.Approvals = new List<Document>();
|
||||||
internship.Documentation = new List<Document>();
|
internship.Documentation = new List<Document>();
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using InternshipSystem.Core.Entity.Internship;
|
|
||||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
|
||||||
|
|
||||||
namespace InternshipSystem.Core
|
|
||||||
{
|
|
||||||
public class InternshipProgram
|
|
||||||
{
|
|
||||||
public long Id { get; set; }
|
|
||||||
public Mentor Mentor { get; set; }
|
|
||||||
public DocumentState State { get; set; }
|
|
||||||
public List<ProgramSubject> ChosenSubjects { get; set; }
|
|
||||||
|
|
||||||
public static InternshipProgram Create()
|
|
||||||
{
|
|
||||||
return new InternshipProgram();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -245,9 +245,6 @@ namespace InternshipSystem.Repository
|
|||||||
.First(c => c.Name.Equals("Intel"))
|
.First(c => c.Name.Equals("Intel"))
|
||||||
.Branches
|
.Branches
|
||||||
.First(),
|
.First(),
|
||||||
},
|
|
||||||
InternshipProgram = new InternshipProgram
|
|
||||||
{
|
|
||||||
Mentor = new Mentor
|
Mentor = new Mentor
|
||||||
{
|
{
|
||||||
FirstName = "Horacy",
|
FirstName = "Horacy",
|
||||||
@ -255,7 +252,7 @@ namespace InternshipSystem.Repository
|
|||||||
Email = "howos@intel.com",
|
Email = "howos@intel.com",
|
||||||
PhoneNumber = "605-555-555",
|
PhoneNumber = "605-555-555",
|
||||||
},
|
},
|
||||||
ChosenSubjects = new List<ProgramSubject>
|
Subjects = new List<ProgramSubject>
|
||||||
{
|
{
|
||||||
new ProgramSubject
|
new ProgramSubject
|
||||||
{
|
{
|
||||||
@ -294,9 +291,6 @@ namespace InternshipSystem.Repository
|
|||||||
.First(c => c.Name.Equals("Asseco Poland"))
|
.First(c => c.Name.Equals("Asseco Poland"))
|
||||||
.Branches
|
.Branches
|
||||||
.First(),
|
.First(),
|
||||||
},
|
|
||||||
InternshipProgram = new InternshipProgram
|
|
||||||
{
|
|
||||||
Mentor = new Mentor
|
Mentor = new Mentor
|
||||||
{
|
{
|
||||||
FirstName = "Henryk",
|
FirstName = "Henryk",
|
||||||
@ -304,7 +298,7 @@ namespace InternshipSystem.Repository
|
|||||||
Email = "hepol@asseco.pl",
|
Email = "hepol@asseco.pl",
|
||||||
PhoneNumber = "555-525-545",
|
PhoneNumber = "555-525-545",
|
||||||
},
|
},
|
||||||
ChosenSubjects = new List<ProgramSubject>
|
Subjects = new List<ProgramSubject>
|
||||||
{
|
{
|
||||||
new ProgramSubject
|
new ProgramSubject
|
||||||
{
|
{
|
||||||
|
@ -27,8 +27,9 @@ namespace InternshipSystem.Repository
|
|||||||
modelBuilder.Entity<BranchOffice>()
|
modelBuilder.Entity<BranchOffice>()
|
||||||
.OwnsOne(bo => bo.Address);
|
.OwnsOne(bo => bo.Address);
|
||||||
|
|
||||||
modelBuilder.Entity<InternshipProgram>()
|
|
||||||
.OwnsOne(ip => ip.Mentor);
|
modelBuilder.Entity<InternshipRegistration>()
|
||||||
|
.OwnsOne(ir => ir.Mentor);
|
||||||
|
|
||||||
modelBuilder.Entity<ProgramSubject>(builder =>
|
modelBuilder.Entity<ProgramSubject>(builder =>
|
||||||
{
|
{
|
||||||
|
@ -10,8 +10,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace InternshipSystem.Repository.Migrations
|
namespace InternshipSystem.Repository.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(InternshipDbContext))]
|
[DbContext(typeof(InternshipDbContext))]
|
||||||
[Migration("20200927114840_init")]
|
[Migration("20201002175217_Initial")]
|
||||||
partial class init
|
partial class Initial
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -33,6 +33,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("company_id")
|
.HasColumnName("company_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("Provider")
|
||||||
|
.HasColumnName("provider")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_branch_office");
|
.HasName("pk_branch_office");
|
||||||
|
|
||||||
@ -58,6 +62,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("nip")
|
.HasColumnName("nip")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Provider")
|
||||||
|
.HasColumnName("provider")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_companies");
|
.HasName("pk_companies");
|
||||||
|
|
||||||
@ -240,10 +248,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("grade")
|
.HasColumnName("grade")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.Property<long?>("InternshipProgramId")
|
|
||||||
.HasColumnName("internship_program_id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("InternshipRegistrationId")
|
b.Property<long?>("InternshipRegistrationId")
|
||||||
.HasColumnName("internship_registration_id")
|
.HasColumnName("internship_registration_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
@ -262,9 +266,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.HasIndex("EditionId")
|
b.HasIndex("EditionId")
|
||||||
.HasName("ix_internship_edition_id");
|
.HasName("ix_internship_edition_id");
|
||||||
|
|
||||||
b.HasIndex("InternshipProgramId")
|
|
||||||
.HasName("ix_internship_internship_program_id");
|
|
||||||
|
|
||||||
b.HasIndex("InternshipRegistrationId")
|
b.HasIndex("InternshipRegistrationId")
|
||||||
.HasName("ix_internship_internship_registration_id");
|
.HasName("ix_internship_internship_registration_id");
|
||||||
|
|
||||||
@ -277,24 +278,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship");
|
b.ToTable("internship");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnName("id")
|
|
||||||
.HasColumnType("bigint")
|
|
||||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
|
|
||||||
b.Property<int>("State")
|
|
||||||
.HasColumnName("state")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
|
||||||
.HasName("pk_internship_program");
|
|
||||||
|
|
||||||
b.ToTable("internship_program");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -461,15 +444,15 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("InternshipProgramId")
|
b.Property<long>("InternshipRegistrationId")
|
||||||
.HasColumnName("internship_program_id")
|
.HasColumnName("internship_registration_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<long>("InternshipSubjectId")
|
b.Property<long>("InternshipSubjectId")
|
||||||
.HasColumnName("internship_subject_id")
|
.HasColumnName("internship_subject_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("InternshipProgramId", "InternshipSubjectId")
|
b.HasKey("InternshipRegistrationId", "InternshipSubjectId")
|
||||||
.HasName("pk_program_subject");
|
.HasName("pk_program_subject");
|
||||||
|
|
||||||
b.HasIndex("InternshipSubjectId")
|
b.HasIndex("InternshipSubjectId")
|
||||||
@ -565,11 +548,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasForeignKey("EditionId")
|
.HasForeignKey("EditionId")
|
||||||
.HasConstraintName("fk_internship_editions_edition_id");
|
.HasConstraintName("fk_internship_editions_edition_id");
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.InternshipProgram", "InternshipProgram")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("InternshipProgramId")
|
|
||||||
.HasConstraintName("fk_internship_internship_program_internship_program_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
|
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("InternshipRegistrationId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
@ -586,11 +564,26 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasConstraintName("fk_internship_students_student_id");
|
.HasConstraintName("fk_internship_students_student_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
|
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BranchAddressId")
|
||||||
|
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Company", "Company")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CompanyId")
|
||||||
|
.HasConstraintName("fk_internship_registration_companies_company_id");
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("TypeId")
|
||||||
|
.HasConstraintName("fk_internship_registration_internship_types_type_id");
|
||||||
|
|
||||||
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
|
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
|
||||||
{
|
{
|
||||||
b1.Property<long>("InternshipProgramId")
|
b1.Property<long>("InternshipRegistrationId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnType("bigint")
|
.HasColumnType("bigint")
|
||||||
@ -612,35 +605,17 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("phone_number")
|
.HasColumnName("phone_number")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b1.HasKey("InternshipProgramId")
|
b1.HasKey("InternshipRegistrationId")
|
||||||
.HasName("pk_internship_program");
|
.HasName("pk_internship_registration");
|
||||||
|
|
||||||
b1.ToTable("internship_program");
|
b1.ToTable("internship_registration");
|
||||||
|
|
||||||
b1.WithOwner()
|
b1.WithOwner()
|
||||||
.HasForeignKey("InternshipProgramId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_mentor_internship_program_internship_program_id");
|
.HasConstraintName("fk_mentor_internship_registration_internship_registration_id");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("BranchAddressId")
|
|
||||||
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Company", "Company")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CompanyId")
|
|
||||||
.HasConstraintName("fk_internship_registration_companies_company_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("TypeId")
|
|
||||||
.HasConstraintName("fk_internship_registration_internship_types_type_id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
@ -660,10 +635,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.InternshipProgram", "Program")
|
b.HasOne("InternshipSystem.Core.InternshipRegistration", "Registration")
|
||||||
.WithMany("ChosenSubjects")
|
.WithMany("Subjects")
|
||||||
.HasForeignKey("InternshipProgramId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_program_subject_internship_program_internship_program_id")
|
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
|
|
||||||
namespace InternshipSystem.Repository.Migrations
|
namespace InternshipSystem.Repository.Migrations
|
||||||
{
|
{
|
||||||
public partial class init : Migration
|
public partial class Initial : Migration
|
||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
@ -15,7 +15,8 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
id = table.Column<long>(nullable: false)
|
id = table.Column<long>(nullable: false)
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
nip = table.Column<string>(nullable: true),
|
nip = table.Column<string>(nullable: true),
|
||||||
name = table.Column<string>(nullable: true)
|
name = table.Column<string>(nullable: true),
|
||||||
|
provider = table.Column<long>(nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -35,23 +36,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
table.PrimaryKey("pk_course", x => x.id);
|
table.PrimaryKey("pk_course", x => x.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "internship_program",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
id = table.Column<long>(nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
first_name = table.Column<string>(nullable: true),
|
|
||||||
last_name = table.Column<string>(nullable: true),
|
|
||||||
email = table.Column<string>(nullable: true),
|
|
||||||
phone_number = table.Column<string>(nullable: true),
|
|
||||||
state = table.Column<int>(nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("pk_internship_program", x => x.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "internship_subject",
|
name: "internship_subject",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -127,6 +111,7 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
city = table.Column<string>(nullable: true),
|
city = table.Column<string>(nullable: true),
|
||||||
postal_code = table.Column<string>(nullable: true),
|
postal_code = table.Column<string>(nullable: true),
|
||||||
country = table.Column<string>(nullable: true),
|
country = table.Column<string>(nullable: true),
|
||||||
|
provider = table.Column<long>(nullable: false),
|
||||||
company_id = table.Column<long>(nullable: true)
|
company_id = table.Column<long>(nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
@ -140,30 +125,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "program_subject",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
internship_program_id = table.Column<long>(nullable: false),
|
|
||||||
internship_subject_id = table.Column<long>(nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("pk_program_subject", x => new { x.internship_program_id, x.internship_subject_id });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_program_subject_internship_program_internship_program_id",
|
|
||||||
column: x => x.internship_program_id,
|
|
||||||
principalTable: "internship_program",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_program_subject_internship_subject_internship_subject_id",
|
|
||||||
column: x => x.internship_subject_id,
|
|
||||||
principalTable: "internship_subject",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "internship_registration",
|
name: "internship_registration",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -174,6 +135,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
branch_address_id = table.Column<long>(nullable: true),
|
branch_address_id = table.Column<long>(nullable: true),
|
||||||
start = table.Column<DateTime>(nullable: false),
|
start = table.Column<DateTime>(nullable: false),
|
||||||
end = table.Column<DateTime>(nullable: false),
|
end = table.Column<DateTime>(nullable: false),
|
||||||
|
first_name = table.Column<string>(nullable: true),
|
||||||
|
last_name = table.Column<string>(nullable: true),
|
||||||
|
email = table.Column<string>(nullable: true),
|
||||||
|
phone_number = table.Column<string>(nullable: true),
|
||||||
type_id = table.Column<long>(nullable: true),
|
type_id = table.Column<long>(nullable: true),
|
||||||
state = table.Column<int>(nullable: false)
|
state = table.Column<int>(nullable: false)
|
||||||
},
|
},
|
||||||
@ -194,6 +159,30 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "program_subject",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
internship_registration_id = table.Column<long>(nullable: false),
|
||||||
|
internship_subject_id = table.Column<long>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_program_subject", x => new { x.internship_registration_id, x.internship_subject_id });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_program_subject_internship_registration_internship_registrat",
|
||||||
|
column: x => x.internship_registration_id,
|
||||||
|
principalTable: "internship_registration",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_program_subject_internship_subject_internship_subject_id",
|
||||||
|
column: x => x.internship_subject_id,
|
||||||
|
principalTable: "internship_subject",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "editions",
|
name: "editions",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -248,7 +237,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
student_id = table.Column<long>(nullable: true),
|
student_id = table.Column<long>(nullable: true),
|
||||||
internship_registration_id = table.Column<long>(nullable: true),
|
internship_registration_id = table.Column<long>(nullable: true),
|
||||||
internship_program_id = table.Column<long>(nullable: true),
|
|
||||||
report_id = table.Column<long>(nullable: true),
|
report_id = table.Column<long>(nullable: true),
|
||||||
edition_id = table.Column<Guid>(nullable: true),
|
edition_id = table.Column<Guid>(nullable: true),
|
||||||
grade = table.Column<float>(nullable: true)
|
grade = table.Column<float>(nullable: true)
|
||||||
@ -262,12 +250,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
principalTable: "editions",
|
principalTable: "editions",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_internship_internship_program_internship_program_id",
|
|
||||||
column: x => x.internship_program_id,
|
|
||||||
principalTable: "internship_program",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_internship_internship_registration_internship_registration_",
|
name: "fk_internship_internship_registration_internship_registration_",
|
||||||
column: x => x.internship_registration_id,
|
column: x => x.internship_registration_id,
|
||||||
@ -376,11 +358,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
table: "internship",
|
table: "internship",
|
||||||
column: "edition_id");
|
column: "edition_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "ix_internship_internship_program_id",
|
|
||||||
table: "internship",
|
|
||||||
column: "internship_program_id");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_internship_internship_registration_id",
|
name: "ix_internship_internship_registration_id",
|
||||||
table: "internship",
|
table: "internship",
|
||||||
@ -462,9 +439,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internship_subject");
|
name: "internship_subject");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "internship_program");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "internship_registration");
|
name: "internship_registration");
|
||||||
|
|
@ -31,6 +31,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("company_id")
|
.HasColumnName("company_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("Provider")
|
||||||
|
.HasColumnName("provider")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_branch_office");
|
.HasName("pk_branch_office");
|
||||||
|
|
||||||
@ -56,6 +60,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("nip")
|
.HasColumnName("nip")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Provider")
|
||||||
|
.HasColumnName("provider")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_companies");
|
.HasName("pk_companies");
|
||||||
|
|
||||||
@ -238,10 +246,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("grade")
|
.HasColumnName("grade")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.Property<long?>("InternshipProgramId")
|
|
||||||
.HasColumnName("internship_program_id")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("InternshipRegistrationId")
|
b.Property<long?>("InternshipRegistrationId")
|
||||||
.HasColumnName("internship_registration_id")
|
.HasColumnName("internship_registration_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
@ -260,9 +264,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.HasIndex("EditionId")
|
b.HasIndex("EditionId")
|
||||||
.HasName("ix_internship_edition_id");
|
.HasName("ix_internship_edition_id");
|
||||||
|
|
||||||
b.HasIndex("InternshipProgramId")
|
|
||||||
.HasName("ix_internship_internship_program_id");
|
|
||||||
|
|
||||||
b.HasIndex("InternshipRegistrationId")
|
b.HasIndex("InternshipRegistrationId")
|
||||||
.HasName("ix_internship_internship_registration_id");
|
.HasName("ix_internship_internship_registration_id");
|
||||||
|
|
||||||
@ -275,24 +276,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
b.ToTable("internship");
|
b.ToTable("internship");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
|
|
||||||
{
|
|
||||||
b.Property<long>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnName("id")
|
|
||||||
.HasColumnType("bigint")
|
|
||||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
|
||||||
|
|
||||||
b.Property<int>("State")
|
|
||||||
.HasColumnName("state")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
|
||||||
.HasName("pk_internship_program");
|
|
||||||
|
|
||||||
b.ToTable("internship_program");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("Id")
|
b.Property<long>("Id")
|
||||||
@ -459,15 +442,15 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||||
{
|
{
|
||||||
b.Property<long>("InternshipProgramId")
|
b.Property<long>("InternshipRegistrationId")
|
||||||
.HasColumnName("internship_program_id")
|
.HasColumnName("internship_registration_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<long>("InternshipSubjectId")
|
b.Property<long>("InternshipSubjectId")
|
||||||
.HasColumnName("internship_subject_id")
|
.HasColumnName("internship_subject_id")
|
||||||
.HasColumnType("bigint");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.HasKey("InternshipProgramId", "InternshipSubjectId")
|
b.HasKey("InternshipRegistrationId", "InternshipSubjectId")
|
||||||
.HasName("pk_program_subject");
|
.HasName("pk_program_subject");
|
||||||
|
|
||||||
b.HasIndex("InternshipSubjectId")
|
b.HasIndex("InternshipSubjectId")
|
||||||
@ -563,11 +546,6 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasForeignKey("EditionId")
|
.HasForeignKey("EditionId")
|
||||||
.HasConstraintName("fk_internship_editions_edition_id");
|
.HasConstraintName("fk_internship_editions_edition_id");
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.InternshipProgram", "InternshipProgram")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("InternshipProgramId")
|
|
||||||
.HasConstraintName("fk_internship_internship_program_internship_program_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
|
b.HasOne("InternshipSystem.Core.InternshipRegistration", "InternshipRegistration")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("InternshipRegistrationId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
@ -584,11 +562,26 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasConstraintName("fk_internship_students_student_id");
|
.HasConstraintName("fk_internship_students_student_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipProgram", b =>
|
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BranchAddressId")
|
||||||
|
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Company", "Company")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("CompanyId")
|
||||||
|
.HasConstraintName("fk_internship_registration_companies_company_id");
|
||||||
|
|
||||||
|
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("TypeId")
|
||||||
|
.HasConstraintName("fk_internship_registration_internship_types_type_id");
|
||||||
|
|
||||||
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
|
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
|
||||||
{
|
{
|
||||||
b1.Property<long>("InternshipProgramId")
|
b1.Property<long>("InternshipRegistrationId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnName("id")
|
.HasColumnName("id")
|
||||||
.HasColumnType("bigint")
|
.HasColumnType("bigint")
|
||||||
@ -610,35 +603,17 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
.HasColumnName("phone_number")
|
.HasColumnName("phone_number")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b1.HasKey("InternshipProgramId")
|
b1.HasKey("InternshipRegistrationId")
|
||||||
.HasName("pk_internship_program");
|
.HasName("pk_internship_registration");
|
||||||
|
|
||||||
b1.ToTable("internship_program");
|
b1.ToTable("internship_registration");
|
||||||
|
|
||||||
b1.WithOwner()
|
b1.WithOwner()
|
||||||
.HasForeignKey("InternshipProgramId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_mentor_internship_program_internship_program_id");
|
.HasConstraintName("fk_mentor_internship_registration_internship_registration_id");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.InternshipRegistration", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("BranchAddressId")
|
|
||||||
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Company", "Company")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CompanyId")
|
|
||||||
.HasConstraintName("fk_internship_registration_companies_company_id");
|
|
||||||
|
|
||||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("TypeId")
|
|
||||||
.HasConstraintName("fk_internship_registration_internship_types_type_id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||||
@ -658,10 +633,10 @@ namespace InternshipSystem.Repository.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("InternshipSystem.Core.InternshipProgram", "Program")
|
b.HasOne("InternshipSystem.Core.InternshipRegistration", "Registration")
|
||||||
.WithMany("ChosenSubjects")
|
.WithMany("Subjects")
|
||||||
.HasForeignKey("InternshipProgramId")
|
.HasForeignKey("InternshipRegistrationId")
|
||||||
.HasConstraintName("fk_program_subject_internship_program_internship_program_id")
|
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Threading;
|
||||||
|
using InternshipSystem.Api.Commands;
|
||||||
using InternshipSystem.Api.Controllers;
|
using InternshipSystem.Api.Controllers;
|
||||||
|
using InternshipSystem.Api.Security;
|
||||||
|
using InternshipSystem.Api.UseCases;
|
||||||
|
using InternshipSystem.Core;
|
||||||
using InternshipSystem.Repository;
|
using InternshipSystem.Repository;
|
||||||
using Machine.Specifications;
|
using Machine.Specifications;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace InternshipSystem.Api.Test
|
namespace InternshipSystem.Api.Test
|
||||||
{
|
{
|
||||||
@ -59,15 +65,112 @@ namespace InternshipSystem.Api.Test
|
|||||||
private static CasUserProfile result;
|
private static CasUserProfile result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class When_doint_whatever
|
||||||
|
{
|
||||||
|
private Establish context = () =>
|
||||||
|
{
|
||||||
|
var db = new InternshipDbContext(new DbContextOptionsBuilder<InternshipDbContext>()
|
||||||
|
.UseLoggerFactory(LoggerFactory.Create(b => b.AddConsole()))
|
||||||
|
.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=szwoniu")
|
||||||
|
.Options);
|
||||||
|
|
||||||
|
var company = Company.CreateCompany("a", "b");
|
||||||
|
|
||||||
|
var internship = db.Editions.First();
|
||||||
|
|
||||||
|
|
||||||
|
db.Companies.Add(company);
|
||||||
|
|
||||||
|
db.SaveChanges();
|
||||||
|
};
|
||||||
|
|
||||||
|
private It should_whatev = () => true.ShouldBeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
class When_writing_tests_only_for_debug_because_i_gave_up_on_code_quality
|
class When_writing_tests_only_for_debug_because_i_gave_up_on_code_quality
|
||||||
{
|
{
|
||||||
private Establish context = () =>
|
private Establish context = () =>
|
||||||
{
|
{
|
||||||
var db = new InternshipDbContext(new DbContextOptionsBuilder<InternshipDbContext>()
|
var db = new InternshipDbContext(new DbContextOptionsBuilder<InternshipDbContext>()
|
||||||
|
.UseLoggerFactory(LoggerFactory.Create(b => b.AddConsole()))
|
||||||
.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=szwoniu")
|
.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=szwoniu")
|
||||||
.Options);
|
.Options);
|
||||||
|
|
||||||
var e
|
var ed = db.Editions.First();
|
||||||
|
|
||||||
|
var user = new User
|
||||||
|
{
|
||||||
|
PersonNumber = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var ir = db.Entry(ed)
|
||||||
|
.Collection(e => e.Internships)
|
||||||
|
.Query()
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(r => r.BranchAddress)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(r => r.Company)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(c => c.Company.Branches)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(c => c.Type)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(c => c.Subjects)
|
||||||
|
.Where(i => i.Student.Id == user.PersonNumber)
|
||||||
|
.Select(i => i.InternshipRegistration)
|
||||||
|
.First();
|
||||||
|
|
||||||
|
var useCase = new UpdateInternshipRegistrationUseCase(db, ir, ed, user);
|
||||||
|
|
||||||
|
var update = new UpdateRegistrationForm
|
||||||
|
{
|
||||||
|
Mentor = new UpdateMentor
|
||||||
|
{
|
||||||
|
FirstName = "Cwalina"
|
||||||
|
},
|
||||||
|
Subjects = new List<long>
|
||||||
|
{
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3
|
||||||
|
},
|
||||||
|
Company = new UpdateCompany
|
||||||
|
{
|
||||||
|
Name = "a",
|
||||||
|
BranchOffice = new UpdateBranchOffice
|
||||||
|
{
|
||||||
|
Street = "b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var task = useCase.UpdateInternshipRegistration(update, CancellationToken.None);
|
||||||
|
|
||||||
|
task.Wait();
|
||||||
|
|
||||||
|
var result = task.Result;
|
||||||
|
|
||||||
|
db.SaveChanges();
|
||||||
|
|
||||||
|
ir = db.Entry(ed)
|
||||||
|
.Collection(e => e.Internships)
|
||||||
|
.Query()
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(r => r.BranchAddress)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(r => r.Company)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(c => c.Company.Branches)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(c => c.Type)
|
||||||
|
.Include(i => i.InternshipRegistration)
|
||||||
|
.ThenInclude(c => c.Subjects)
|
||||||
|
.Where(i => i.Student.Id == user.PersonNumber)
|
||||||
|
.Select(i => i.InternshipRegistration)
|
||||||
|
.First();
|
||||||
|
};
|
||||||
|
|
||||||
|
private It should_nop = () => true.ShouldBeTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user