From 7e181f6887c810b52a127c3009e5d7a023ae9ebe Mon Sep 17 00:00:00 2001 From: mborzyszkowski Date: Wed, 8 Jul 2020 18:25:49 +0200 Subject: [PATCH] refactoring Entity class InternshipEntity name changed to Internship namespace Internship changed to InternshipSystem --- InternshipSystem.sln | 10 +- .../20200612141652_InitialCreate.Designer.cs | 428 ---------------- .../20200612141652_InitialCreate.cs | 271 ---------- .../20200706165537_AddMentor.Designer.cs | 462 ------------------ .../Migrations/20200706165537_AddMentor.cs | 49 -- .../InternshipDbContextModelSnapshot.cs | 460 ----------------- .../.dockerignore | 0 .../Controllers/InternshipController.cs | 26 + .../Dockerfile | 0 .../InternshipSystem.Api.csproj} | 4 + .../Program.cs | 2 +- .../Properties/launchSettings.json | 0 .../Startup.cs | 2 +- .../appsettings.Development.json | 0 .../appsettings.json | 0 .../Address.cs | 2 +- .../BranchOffice.cs | 2 +- .../Company.cs | 2 +- .../Course.cs | 2 +- .../DeanAcceptance.cs | 2 +- .../Edition.cs | 2 +- .../Insurance.cs | 2 +- .../Intern.cs | 2 +- .../Internship.cs} | 4 +- .../InternshipProgramSubject.cs | 2 +- .../InternshipSystem.Core.csproj} | 0 .../InternshipType.cs | 2 +- .../Mentor.cs | 2 +- .../RangeOfActivities.cs | 2 +- .../Report.cs | 2 +- .../InternshipDbContext.cs | 8 +- .../InternshipSystem.Repository.csproj} | 2 +- .../InternshipSystem.Api.Test.csproj} | 0 .../InternshipSystem.cs} | 2 +- .../InternshipSystem.Core.Tests.csproj} | 2 +- .../InternshipSystem.Test.cs} | 4 +- 36 files changed, 61 insertions(+), 1701 deletions(-) delete mode 100644 src/Internship.Repository/Migrations/20200612141652_InitialCreate.Designer.cs delete mode 100644 src/Internship.Repository/Migrations/20200612141652_InitialCreate.cs delete mode 100644 src/Internship.Repository/Migrations/20200706165537_AddMentor.Designer.cs delete mode 100644 src/Internship.Repository/Migrations/20200706165537_AddMentor.cs delete mode 100644 src/Internship.Repository/Migrations/InternshipDbContextModelSnapshot.cs rename src/{Internship.Api => InternshipSystem.Api}/.dockerignore (100%) create mode 100644 src/InternshipSystem.Api/Controllers/InternshipController.cs rename src/{Internship.Api => InternshipSystem.Api}/Dockerfile (100%) rename src/{Internship.Api/Internship.Api.csproj => InternshipSystem.Api/InternshipSystem.Api.csproj} (85%) rename src/{Internship.Api => InternshipSystem.Api}/Program.cs (96%) rename src/{Internship.Api => InternshipSystem.Api}/Properties/launchSettings.json (100%) rename src/{Internship.Api => InternshipSystem.Api}/Startup.cs (97%) rename src/{Internship.Api => InternshipSystem.Api}/appsettings.Development.json (100%) rename src/{Internship.Api => InternshipSystem.Api}/appsettings.json (100%) rename src/{Internship.Core => InternshipSystem.Core}/Address.cs (88%) rename src/{Internship.Core => InternshipSystem.Core}/BranchOffice.cs (85%) rename src/{Internship.Core => InternshipSystem.Core}/Company.cs (92%) rename src/{Internship.Core => InternshipSystem.Core}/Course.cs (76%) rename src/{Internship.Core => InternshipSystem.Core}/DeanAcceptance.cs (91%) rename src/{Internship.Core => InternshipSystem.Core}/Edition.cs (91%) rename src/{Internship.Core => InternshipSystem.Core}/Insurance.cs (84%) rename src/{Internship.Core => InternshipSystem.Core}/Intern.cs (90%) rename src/{Internship.Core/InternshipEntity.cs => InternshipSystem.Core/Internship.cs} (92%) rename src/{Internship.Core => InternshipSystem.Core}/InternshipProgramSubject.cs (84%) rename src/{Internship.Core/Internship.Core.csproj => InternshipSystem.Core/InternshipSystem.Core.csproj} (100%) rename src/{Internship.Core => InternshipSystem.Core}/InternshipType.cs (88%) rename src/{Internship.Core => InternshipSystem.Core}/Mentor.cs (86%) rename src/{Internship.Core => InternshipSystem.Core}/RangeOfActivities.cs (74%) rename src/{Internship.Core => InternshipSystem.Core}/Report.cs (68%) rename src/{Internship.Repository => InternshipSystem.Repository}/InternshipDbContext.cs (87%) rename src/{Internship.Repository/Internship.Repository.csproj => InternshipSystem.Repository/InternshipSystem.Repository.csproj} (89%) rename test/{Internship.Api.Test/Internship.Api.Test.csproj => InternshipSystem.Api.Test/InternshipSystem.Api.Test.csproj} (100%) rename test/{Internship.Api.Test/InternshipTests.cs => InternshipSystem.Api.Test/InternshipSystem.cs} (57%) rename test/{Internship.Core.Tests/Internship.Core.Tests.csproj => InternshipSystem.Core.Tests/InternshipSystem.Core.Tests.csproj} (88%) rename test/{Internship.Core.Tests/Internship.Test.cs => InternshipSystem.Core.Tests/InternshipSystem.Test.cs} (79%) diff --git a/InternshipSystem.sln b/InternshipSystem.sln index 752cf0d..d2fe9d7 100644 --- a/InternshipSystem.sln +++ b/InternshipSystem.sln @@ -5,17 +5,17 @@ VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A43DB15B-657C-4E02-BC1B-2670DD34D9E0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internship.Api", "src\Internship.Api\Internship.Api.csproj", "{2C72839D-2E0B-4794-9324-3E9E622251E3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternshipSystem.Api", "src\InternshipSystem.Api\InternshipSystem.Api.csproj", "{2C72839D-2E0B-4794-9324-3E9E622251E3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internship.Repository", "src\Internship.Repository\Internship.Repository.csproj", "{A4697640-0746-4720-9B20-923763612F1A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternshipSystem.Repository", "src\InternshipSystem.Repository\InternshipSystem.Repository.csproj", "{A4697640-0746-4720-9B20-923763612F1A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internship.Core", "src\Internship.Core\Internship.Core.csproj", "{2C395A11-E3A2-4454-95A1-82A3EAE791EC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternshipSystem.Core", "src\InternshipSystem.Core\InternshipSystem.Core.csproj", "{2C395A11-E3A2-4454-95A1-82A3EAE791EC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{69F62FEE-6768-4B47-9295-4EF5E8E30BEA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internship.Api.Test", "test\Internship.Api.Test\Internship.Api.Test.csproj", "{90365B6B-B2C6-49D9-84F7-F806B06C1AFE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternshipSystem.Api.Test", "test\InternshipSystem.Api.Test\InternshipSystem.Api.Test.csproj", "{90365B6B-B2C6-49D9-84F7-F806B06C1AFE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Internship.Core.Tests", "test\Internship.Core.Tests\Internship.Core.Tests.csproj", "{748544B4-CBDA-4123-9BD9-499F6C90567F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternshipSystem.Core.Tests", "test\InternshipSystem.Core.Tests\InternshipSystem.Core.Tests.csproj", "{748544B4-CBDA-4123-9BD9-499F6C90567F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Internship.Repository/Migrations/20200612141652_InitialCreate.Designer.cs b/src/Internship.Repository/Migrations/20200612141652_InitialCreate.Designer.cs deleted file mode 100644 index 919d734..0000000 --- a/src/Internship.Repository/Migrations/20200612141652_InitialCreate.Designer.cs +++ /dev/null @@ -1,428 +0,0 @@ -// -using System; -using Internship.Repository; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace Internship.Repository.Migrations -{ - [DbContext(typeof(InternshipDbContext))] - [Migration("20200612141652_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - modelBuilder.Entity("Internship.Core.BranchOffice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CompanyNip") - .HasColumnName("company_nip") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnName("provider") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_branch_office"); - - b.HasIndex("CompanyNip") - .HasName("ix_branch_office_company_nip"); - - b.ToTable("branch_office"); - }); - - modelBuilder.Entity("Internship.Core.Company", b => - { - b.Property("Nip") - .HasColumnName("nip") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnName("provider") - .HasColumnType("integer"); - - b.Property("Range") - .HasColumnName("range") - .HasColumnType("integer"); - - b.Property("SiteAddress") - .HasColumnName("site_address") - .HasColumnType("text"); - - b.HasKey("Nip") - .HasName("pk_companies"); - - b.ToTable("companies"); - }); - - modelBuilder.Entity("Internship.Core.Course", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.HasKey("Id") - .HasName("pk_course"); - - b.ToTable("course"); - }); - - modelBuilder.Entity("Internship.Core.Edition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("EndDate") - .HasColumnName("end_date") - .HasColumnType("timestamp without time zone"); - - b.Property("IPPDeadlineDate") - .HasColumnName("ipp_deadline_date") - .HasColumnType("timestamp without time zone"); - - b.Property("StartDate") - .HasColumnName("start_date") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasName("pk_editions"); - - b.ToTable("editions"); - }); - - modelBuilder.Entity("Internship.Core.Intern", b => - { - b.Property("AlbumNumber") - .HasColumnName("album_number") - .HasColumnType("text"); - - b.Property("CourseId") - .HasColumnName("course_id") - .HasColumnType("integer"); - - b.Property("Email") - .HasColumnName("email") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.Property("Semester") - .HasColumnName("semester") - .HasColumnType("integer"); - - b.Property("Surname") - .HasColumnName("surname") - .HasColumnType("text"); - - b.HasKey("AlbumNumber") - .HasName("pk_interns"); - - b.HasIndex("CourseId") - .HasName("ix_interns_course_id"); - - b.ToTable("interns"); - }); - - modelBuilder.Entity("Internship.Core.InternshipEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BranchOfficeId") - .HasColumnName("branch_office_id") - .HasColumnType("integer"); - - b.Property("EditionId") - .HasColumnName("edition_id") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnName("end_date") - .HasColumnType("timestamp without time zone"); - - b.Property("Grade") - .HasColumnName("grade") - .HasColumnType("real"); - - b.Property("InternAlbumNumber") - .HasColumnName("intern_album_number") - .HasColumnType("text"); - - b.Property("InternshipLengthInWeeks") - .HasColumnName("internship_length_in_weeks") - .HasColumnType("integer"); - - b.Property("IsAccepted") - .HasColumnName("is_accepted") - .HasColumnType("boolean"); - - b.Property("ReportId") - .HasColumnName("report_id") - .HasColumnType("integer"); - - b.Property("StartDate") - .HasColumnName("start_date") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnName("type") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_internships"); - - b.HasIndex("BranchOfficeId") - .HasName("ix_internships_branch_office_id"); - - b.HasIndex("EditionId") - .HasName("ix_internships_edition_id"); - - b.HasIndex("InternAlbumNumber") - .HasName("ix_internships_intern_album_number"); - - b.HasIndex("ReportId") - .HasName("ix_internships_report_id"); - - b.ToTable("internships"); - }); - - modelBuilder.Entity("Internship.Core.InternshipProgramSubject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CourseId") - .HasColumnName("course_id") - .HasColumnType("integer"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("text"); - - b.Property("EditionId") - .HasColumnName("edition_id") - .HasColumnType("integer"); - - b.Property("InternshipEntityId") - .HasColumnName("internship_entity_id") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_internship_program_subject"); - - b.HasIndex("CourseId") - .HasName("ix_internship_program_subject_course_id"); - - b.HasIndex("EditionId") - .HasName("ix_internship_program_subject_edition_id"); - - b.HasIndex("InternshipEntityId") - .HasName("ix_internship_program_subject_internship_entity_id"); - - b.ToTable("internship_program_subject"); - }); - - modelBuilder.Entity("Internship.Core.Report", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.HasKey("Id") - .HasName("pk_reports"); - - b.ToTable("reports"); - }); - - modelBuilder.Entity("Internship.Core.BranchOffice", b => - { - b.HasOne("Internship.Core.Company", "Company") - .WithMany("Branches") - .HasForeignKey("CompanyNip") - .HasConstraintName("fk_branch_office_companies_company_nip"); - - b.OwnsOne("Internship.Core.Address", "Address", b1 => - { - b1.Property("BranchOfficeId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("Building") - .HasColumnName("building") - .HasColumnType("text"); - - b1.Property("City") - .HasColumnName("city") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnName("country") - .HasColumnType("text"); - - b1.Property("PostalCode") - .HasColumnName("postal_code") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnName("street") - .HasColumnType("text"); - - b1.HasKey("BranchOfficeId") - .HasName("pk_branch_office"); - - b1.ToTable("branch_office"); - - b1.WithOwner() - .HasForeignKey("BranchOfficeId") - .HasConstraintName("fk_address_branch_office_branch_office_id"); - }); - }); - - modelBuilder.Entity("Internship.Core.Intern", b => - { - b.HasOne("Internship.Core.Course", "Course") - .WithMany() - .HasForeignKey("CourseId") - .HasConstraintName("fk_interns_course_course_id"); - }); - - modelBuilder.Entity("Internship.Core.InternshipEntity", b => - { - b.HasOne("Internship.Core.BranchOffice", "BranchOffice") - .WithMany() - .HasForeignKey("BranchOfficeId") - .HasConstraintName("fk_internships_branch_office_branch_office_id"); - - b.HasOne("Internship.Core.Edition", "Edition") - .WithMany() - .HasForeignKey("EditionId") - .HasConstraintName("fk_internships_editions_edition_id"); - - b.HasOne("Internship.Core.Intern", "Intern") - .WithMany() - .HasForeignKey("InternAlbumNumber") - .HasConstraintName("fk_internships_interns_intern_album_number"); - - b.HasOne("Internship.Core.Report", "Report") - .WithMany() - .HasForeignKey("ReportId") - .HasConstraintName("fk_internships_reports_report_id"); - - b.OwnsOne("Internship.Core.DeanAcceptance", "DeanAcceptance", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("AcceptanceDate") - .HasColumnName("acceptance_date") - .HasColumnType("timestamp without time zone"); - - b1.Property("IsDeansAcceptanceRequired") - .HasColumnName("is_deans_acceptance_required") - .HasColumnType("boolean"); - - b1.Property("Reason") - .HasColumnName("reason") - .HasColumnType("integer"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_dean_acceptance_internships_internship_entity_id"); - }); - - b.OwnsOne("Internship.Core.Insurance", "Insurance", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("InsuranceDeliveryDate") - .HasColumnName("insurance_delivery_date") - .HasColumnType("timestamp without time zone"); - - b1.Property("IsInsuranceRequired") - .HasColumnName("is_insurance_required") - .HasColumnType("boolean"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_insurance_internships_internship_entity_id"); - }); - }); - - modelBuilder.Entity("Internship.Core.InternshipProgramSubject", b => - { - b.HasOne("Internship.Core.Course", "Course") - .WithMany() - .HasForeignKey("CourseId") - .HasConstraintName("fk_internship_program_subject_course_course_id"); - - b.HasOne("Internship.Core.Edition", null) - .WithMany("Subjects") - .HasForeignKey("EditionId") - .HasConstraintName("fk_internship_program_subject_editions_edition_id"); - - b.HasOne("Internship.Core.InternshipEntity", null) - .WithMany("Program") - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_internship_program_subject_internships_internship_entity_id"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Internship.Repository/Migrations/20200612141652_InitialCreate.cs b/src/Internship.Repository/Migrations/20200612141652_InitialCreate.cs deleted file mode 100644 index 3c21540..0000000 --- a/src/Internship.Repository/Migrations/20200612141652_InitialCreate.cs +++ /dev/null @@ -1,271 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace Internship.Repository.Migrations -{ - public partial class InitialCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "companies", - columns: table => new - { - nip = table.Column(nullable: false), - name = table.Column(nullable: true), - range = table.Column(nullable: false), - site_address = table.Column(nullable: true), - provider = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_companies", x => x.nip); - }); - - migrationBuilder.CreateTable( - name: "course", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - name = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_course", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "editions", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - start_date = table.Column(nullable: false), - end_date = table.Column(nullable: false), - ipp_deadline_date = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_editions", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "reports", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - }, - constraints: table => - { - table.PrimaryKey("pk_reports", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "branch_office", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - street = table.Column(nullable: true), - building = table.Column(nullable: true), - city = table.Column(nullable: true), - postal_code = table.Column(nullable: true), - country = table.Column(nullable: true), - company_nip = table.Column(nullable: true), - provider = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_branch_office", x => x.id); - table.ForeignKey( - name: "fk_branch_office_companies_company_nip", - column: x => x.company_nip, - principalTable: "companies", - principalColumn: "nip", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "interns", - columns: table => new - { - album_number = table.Column(nullable: false), - name = table.Column(nullable: true), - surname = table.Column(nullable: true), - email = table.Column(nullable: true), - course_id = table.Column(nullable: true), - semester = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_interns", x => x.album_number); - table.ForeignKey( - name: "fk_interns_course_course_id", - column: x => x.course_id, - principalTable: "course", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "internships", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - intern_album_number = table.Column(nullable: true), - edition_id = table.Column(nullable: true), - report_id = table.Column(nullable: true), - branch_office_id = table.Column(nullable: true), - type = table.Column(nullable: false), - start_date = table.Column(nullable: false), - end_date = table.Column(nullable: false), - is_accepted = table.Column(nullable: false), - acceptance_date = table.Column(nullable: true), - is_deans_acceptance_required = table.Column(nullable: true), - reason = table.Column(nullable: true), - insurance_delivery_date = table.Column(nullable: true), - is_insurance_required = table.Column(nullable: true), - internship_length_in_weeks = table.Column(nullable: false), - grade = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_internships", x => x.id); - table.ForeignKey( - name: "fk_internships_branch_office_branch_office_id", - column: x => x.branch_office_id, - principalTable: "branch_office", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_internships_editions_edition_id", - column: x => x.edition_id, - principalTable: "editions", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_internships_interns_intern_album_number", - column: x => x.intern_album_number, - principalTable: "interns", - principalColumn: "album_number", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_internships_reports_report_id", - column: x => x.report_id, - principalTable: "reports", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "internship_program_subject", - columns: table => new - { - id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - course_id = table.Column(nullable: true), - description = table.Column(nullable: true), - edition_id = table.Column(nullable: true), - internship_entity_id = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_internship_program_subject", x => x.id); - table.ForeignKey( - name: "fk_internship_program_subject_course_course_id", - column: x => x.course_id, - principalTable: "course", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_internship_program_subject_editions_edition_id", - column: x => x.edition_id, - principalTable: "editions", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "fk_internship_program_subject_internships_internship_entity_id", - column: x => x.internship_entity_id, - principalTable: "internships", - principalColumn: "id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "ix_branch_office_company_nip", - table: "branch_office", - column: "company_nip"); - - migrationBuilder.CreateIndex( - name: "ix_interns_course_id", - table: "interns", - column: "course_id"); - - migrationBuilder.CreateIndex( - name: "ix_internship_program_subject_course_id", - table: "internship_program_subject", - column: "course_id"); - - migrationBuilder.CreateIndex( - name: "ix_internship_program_subject_edition_id", - table: "internship_program_subject", - column: "edition_id"); - - migrationBuilder.CreateIndex( - name: "ix_internship_program_subject_internship_entity_id", - table: "internship_program_subject", - column: "internship_entity_id"); - - migrationBuilder.CreateIndex( - name: "ix_internships_branch_office_id", - table: "internships", - column: "branch_office_id"); - - migrationBuilder.CreateIndex( - name: "ix_internships_edition_id", - table: "internships", - column: "edition_id"); - - migrationBuilder.CreateIndex( - name: "ix_internships_intern_album_number", - table: "internships", - column: "intern_album_number"); - - migrationBuilder.CreateIndex( - name: "ix_internships_report_id", - table: "internships", - column: "report_id"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "internship_program_subject"); - - migrationBuilder.DropTable( - name: "internships"); - - migrationBuilder.DropTable( - name: "branch_office"); - - migrationBuilder.DropTable( - name: "editions"); - - migrationBuilder.DropTable( - name: "interns"); - - migrationBuilder.DropTable( - name: "reports"); - - migrationBuilder.DropTable( - name: "companies"); - - migrationBuilder.DropTable( - name: "course"); - } - } -} diff --git a/src/Internship.Repository/Migrations/20200706165537_AddMentor.Designer.cs b/src/Internship.Repository/Migrations/20200706165537_AddMentor.Designer.cs deleted file mode 100644 index 9cdee56..0000000 --- a/src/Internship.Repository/Migrations/20200706165537_AddMentor.Designer.cs +++ /dev/null @@ -1,462 +0,0 @@ -// -using System; -using Internship.Repository; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace Internship.Repository.Migrations -{ - [DbContext(typeof(InternshipDbContext))] - [Migration("20200706165537_AddMentor")] - partial class AddMentor - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - modelBuilder.Entity("Internship.Core.BranchOffice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CompanyNip") - .HasColumnName("company_nip") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnName("provider") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_branch_office"); - - b.HasIndex("CompanyNip") - .HasName("ix_branch_office_company_nip"); - - b.ToTable("branch_office"); - }); - - modelBuilder.Entity("Internship.Core.Company", b => - { - b.Property("Nip") - .HasColumnName("nip") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnName("provider") - .HasColumnType("integer"); - - b.Property("Range") - .HasColumnName("range") - .HasColumnType("integer"); - - b.Property("SiteAddress") - .HasColumnName("site_address") - .HasColumnType("text"); - - b.HasKey("Nip") - .HasName("pk_companies"); - - b.ToTable("companies"); - }); - - modelBuilder.Entity("Internship.Core.Course", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.HasKey("Id") - .HasName("pk_course"); - - b.ToTable("course"); - }); - - modelBuilder.Entity("Internship.Core.Edition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("EndDate") - .HasColumnName("end_date") - .HasColumnType("timestamp without time zone"); - - b.Property("IPPDeadlineDate") - .HasColumnName("ipp_deadline_date") - .HasColumnType("timestamp without time zone"); - - b.Property("StartDate") - .HasColumnName("start_date") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasName("pk_editions"); - - b.ToTable("editions"); - }); - - modelBuilder.Entity("Internship.Core.Intern", b => - { - b.Property("AlbumNumber") - .HasColumnName("album_number") - .HasColumnType("text"); - - b.Property("CourseId") - .HasColumnName("course_id") - .HasColumnType("integer"); - - b.Property("Email") - .HasColumnName("email") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.Property("Semester") - .HasColumnName("semester") - .HasColumnType("integer"); - - b.Property("Surname") - .HasColumnName("surname") - .HasColumnType("text"); - - b.HasKey("AlbumNumber") - .HasName("pk_interns"); - - b.HasIndex("CourseId") - .HasName("ix_interns_course_id"); - - b.ToTable("interns"); - }); - - modelBuilder.Entity("Internship.Core.InternshipEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BranchOfficeId") - .HasColumnName("branch_office_id") - .HasColumnType("integer"); - - b.Property("EditionId") - .HasColumnName("edition_id") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnName("end_date") - .HasColumnType("timestamp without time zone"); - - b.Property("Grade") - .HasColumnName("grade") - .HasColumnType("real"); - - b.Property("InternAlbumNumber") - .HasColumnName("intern_album_number") - .HasColumnType("text"); - - b.Property("InternshipLengthInWeeks") - .HasColumnName("internship_length_in_weeks") - .HasColumnType("integer"); - - b.Property("IsAccepted") - .HasColumnName("is_accepted") - .HasColumnType("boolean"); - - b.Property("ReportId") - .HasColumnName("report_id") - .HasColumnType("integer"); - - b.Property("StartDate") - .HasColumnName("start_date") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnName("type") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_internships"); - - b.HasIndex("BranchOfficeId") - .HasName("ix_internships_branch_office_id"); - - b.HasIndex("EditionId") - .HasName("ix_internships_edition_id"); - - b.HasIndex("InternAlbumNumber") - .HasName("ix_internships_intern_album_number"); - - b.HasIndex("ReportId") - .HasName("ix_internships_report_id"); - - b.ToTable("internships"); - }); - - modelBuilder.Entity("Internship.Core.InternshipProgramSubject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CourseId") - .HasColumnName("course_id") - .HasColumnType("integer"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("text"); - - b.Property("EditionId") - .HasColumnName("edition_id") - .HasColumnType("integer"); - - b.Property("InternshipEntityId") - .HasColumnName("internship_entity_id") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_internship_program_subject"); - - b.HasIndex("CourseId") - .HasName("ix_internship_program_subject_course_id"); - - b.HasIndex("EditionId") - .HasName("ix_internship_program_subject_edition_id"); - - b.HasIndex("InternshipEntityId") - .HasName("ix_internship_program_subject_internship_entity_id"); - - b.ToTable("internship_program_subject"); - }); - - modelBuilder.Entity("Internship.Core.Report", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.HasKey("Id") - .HasName("pk_reports"); - - b.ToTable("reports"); - }); - - modelBuilder.Entity("Internship.Core.BranchOffice", b => - { - b.HasOne("Internship.Core.Company", "Company") - .WithMany("Branches") - .HasForeignKey("CompanyNip") - .HasConstraintName("fk_branch_office_companies_company_nip"); - - b.OwnsOne("Internship.Core.Address", "Address", b1 => - { - b1.Property("BranchOfficeId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("Building") - .HasColumnName("building") - .HasColumnType("text"); - - b1.Property("City") - .HasColumnName("city") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnName("country") - .HasColumnType("text"); - - b1.Property("PostalCode") - .HasColumnName("postal_code") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnName("street") - .HasColumnType("text"); - - b1.HasKey("BranchOfficeId") - .HasName("pk_branch_office"); - - b1.ToTable("branch_office"); - - b1.WithOwner() - .HasForeignKey("BranchOfficeId") - .HasConstraintName("fk_address_branch_office_branch_office_id"); - }); - }); - - modelBuilder.Entity("Internship.Core.Intern", b => - { - b.HasOne("Internship.Core.Course", "Course") - .WithMany() - .HasForeignKey("CourseId") - .HasConstraintName("fk_interns_course_course_id"); - }); - - modelBuilder.Entity("Internship.Core.InternshipEntity", b => - { - b.HasOne("Internship.Core.BranchOffice", "BranchOffice") - .WithMany() - .HasForeignKey("BranchOfficeId") - .HasConstraintName("fk_internships_branch_office_branch_office_id"); - - b.HasOne("Internship.Core.Edition", "Edition") - .WithMany() - .HasForeignKey("EditionId") - .HasConstraintName("fk_internships_editions_edition_id"); - - b.HasOne("Internship.Core.Intern", "Intern") - .WithMany() - .HasForeignKey("InternAlbumNumber") - .HasConstraintName("fk_internships_interns_intern_album_number"); - - b.HasOne("Internship.Core.Report", "Report") - .WithMany() - .HasForeignKey("ReportId") - .HasConstraintName("fk_internships_reports_report_id"); - - b.OwnsOne("Internship.Core.DeanAcceptance", "DeanAcceptance", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("AcceptanceDate") - .HasColumnName("acceptance_date") - .HasColumnType("timestamp without time zone"); - - b1.Property("IsDeansAcceptanceRequired") - .HasColumnName("is_deans_acceptance_required") - .HasColumnType("boolean"); - - b1.Property("Reason") - .HasColumnName("reason") - .HasColumnType("integer"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_dean_acceptance_internships_internship_entity_id"); - }); - - b.OwnsOne("Internship.Core.Insurance", "Insurance", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("InsuranceDeliveryDate") - .HasColumnName("insurance_delivery_date") - .HasColumnType("timestamp without time zone"); - - b1.Property("IsInsuranceRequired") - .HasColumnName("is_insurance_required") - .HasColumnType("boolean"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_insurance_internships_internship_entity_id"); - }); - - b.OwnsOne("Internship.Core.Mentor", "Mentor", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("Emali") - .HasColumnName("emali") - .HasColumnType("text"); - - b1.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b1.Property("Phone") - .HasColumnName("phone") - .HasColumnType("text"); - - b1.Property("Surname") - .HasColumnName("surname") - .HasColumnType("text"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_mentor_internships_internship_entity_id"); - }); - }); - - modelBuilder.Entity("Internship.Core.InternshipProgramSubject", b => - { - b.HasOne("Internship.Core.Course", "Course") - .WithMany() - .HasForeignKey("CourseId") - .HasConstraintName("fk_internship_program_subject_course_course_id"); - - b.HasOne("Internship.Core.Edition", null) - .WithMany("Subjects") - .HasForeignKey("EditionId") - .HasConstraintName("fk_internship_program_subject_editions_edition_id"); - - b.HasOne("Internship.Core.InternshipEntity", null) - .WithMany("Program") - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_internship_program_subject_internships_internship_entity_id"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Internship.Repository/Migrations/20200706165537_AddMentor.cs b/src/Internship.Repository/Migrations/20200706165537_AddMentor.cs deleted file mode 100644 index 01a4acf..0000000 --- a/src/Internship.Repository/Migrations/20200706165537_AddMentor.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Internship.Repository.Migrations -{ - public partial class AddMentor : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "emali", - table: "internships", - nullable: true); - - migrationBuilder.AddColumn( - name: "name", - table: "internships", - nullable: true); - - migrationBuilder.AddColumn( - name: "phone", - table: "internships", - nullable: true); - - migrationBuilder.AddColumn( - name: "surname", - table: "internships", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "emali", - table: "internships"); - - migrationBuilder.DropColumn( - name: "name", - table: "internships"); - - migrationBuilder.DropColumn( - name: "phone", - table: "internships"); - - migrationBuilder.DropColumn( - name: "surname", - table: "internships"); - } - } -} diff --git a/src/Internship.Repository/Migrations/InternshipDbContextModelSnapshot.cs b/src/Internship.Repository/Migrations/InternshipDbContextModelSnapshot.cs deleted file mode 100644 index 58f3b0b..0000000 --- a/src/Internship.Repository/Migrations/InternshipDbContextModelSnapshot.cs +++ /dev/null @@ -1,460 +0,0 @@ -// -using System; -using Internship.Repository; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace Internship.Repository.Migrations -{ - [DbContext(typeof(InternshipDbContext))] - partial class InternshipDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.5") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - modelBuilder.Entity("Internship.Core.BranchOffice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CompanyNip") - .HasColumnName("company_nip") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnName("provider") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_branch_office"); - - b.HasIndex("CompanyNip") - .HasName("ix_branch_office_company_nip"); - - b.ToTable("branch_office"); - }); - - modelBuilder.Entity("Internship.Core.Company", b => - { - b.Property("Nip") - .HasColumnName("nip") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.Property("Provider") - .HasColumnName("provider") - .HasColumnType("integer"); - - b.Property("Range") - .HasColumnName("range") - .HasColumnType("integer"); - - b.Property("SiteAddress") - .HasColumnName("site_address") - .HasColumnType("text"); - - b.HasKey("Nip") - .HasName("pk_companies"); - - b.ToTable("companies"); - }); - - modelBuilder.Entity("Internship.Core.Course", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.HasKey("Id") - .HasName("pk_course"); - - b.ToTable("course"); - }); - - modelBuilder.Entity("Internship.Core.Edition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("EndDate") - .HasColumnName("end_date") - .HasColumnType("timestamp without time zone"); - - b.Property("IPPDeadlineDate") - .HasColumnName("ipp_deadline_date") - .HasColumnType("timestamp without time zone"); - - b.Property("StartDate") - .HasColumnName("start_date") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id") - .HasName("pk_editions"); - - b.ToTable("editions"); - }); - - modelBuilder.Entity("Internship.Core.Intern", b => - { - b.Property("AlbumNumber") - .HasColumnName("album_number") - .HasColumnType("text"); - - b.Property("CourseId") - .HasColumnName("course_id") - .HasColumnType("integer"); - - b.Property("Email") - .HasColumnName("email") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b.Property("Semester") - .HasColumnName("semester") - .HasColumnType("integer"); - - b.Property("Surname") - .HasColumnName("surname") - .HasColumnType("text"); - - b.HasKey("AlbumNumber") - .HasName("pk_interns"); - - b.HasIndex("CourseId") - .HasName("ix_interns_course_id"); - - b.ToTable("interns"); - }); - - modelBuilder.Entity("Internship.Core.InternshipEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BranchOfficeId") - .HasColumnName("branch_office_id") - .HasColumnType("integer"); - - b.Property("EditionId") - .HasColumnName("edition_id") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnName("end_date") - .HasColumnType("timestamp without time zone"); - - b.Property("Grade") - .HasColumnName("grade") - .HasColumnType("real"); - - b.Property("InternAlbumNumber") - .HasColumnName("intern_album_number") - .HasColumnType("text"); - - b.Property("InternshipLengthInWeeks") - .HasColumnName("internship_length_in_weeks") - .HasColumnType("integer"); - - b.Property("IsAccepted") - .HasColumnName("is_accepted") - .HasColumnType("boolean"); - - b.Property("ReportId") - .HasColumnName("report_id") - .HasColumnType("integer"); - - b.Property("StartDate") - .HasColumnName("start_date") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnName("type") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_internships"); - - b.HasIndex("BranchOfficeId") - .HasName("ix_internships_branch_office_id"); - - b.HasIndex("EditionId") - .HasName("ix_internships_edition_id"); - - b.HasIndex("InternAlbumNumber") - .HasName("ix_internships_intern_album_number"); - - b.HasIndex("ReportId") - .HasName("ix_internships_report_id"); - - b.ToTable("internships"); - }); - - modelBuilder.Entity("Internship.Core.InternshipProgramSubject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CourseId") - .HasColumnName("course_id") - .HasColumnType("integer"); - - b.Property("Description") - .HasColumnName("description") - .HasColumnType("text"); - - b.Property("EditionId") - .HasColumnName("edition_id") - .HasColumnType("integer"); - - b.Property("InternshipEntityId") - .HasColumnName("internship_entity_id") - .HasColumnType("integer"); - - b.HasKey("Id") - .HasName("pk_internship_program_subject"); - - b.HasIndex("CourseId") - .HasName("ix_internship_program_subject_course_id"); - - b.HasIndex("EditionId") - .HasName("ix_internship_program_subject_edition_id"); - - b.HasIndex("InternshipEntityId") - .HasName("ix_internship_program_subject_internship_entity_id"); - - b.ToTable("internship_program_subject"); - }); - - modelBuilder.Entity("Internship.Core.Report", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.HasKey("Id") - .HasName("pk_reports"); - - b.ToTable("reports"); - }); - - modelBuilder.Entity("Internship.Core.BranchOffice", b => - { - b.HasOne("Internship.Core.Company", "Company") - .WithMany("Branches") - .HasForeignKey("CompanyNip") - .HasConstraintName("fk_branch_office_companies_company_nip"); - - b.OwnsOne("Internship.Core.Address", "Address", b1 => - { - b1.Property("BranchOfficeId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("Building") - .HasColumnName("building") - .HasColumnType("text"); - - b1.Property("City") - .HasColumnName("city") - .HasColumnType("text"); - - b1.Property("Country") - .HasColumnName("country") - .HasColumnType("text"); - - b1.Property("PostalCode") - .HasColumnName("postal_code") - .HasColumnType("text"); - - b1.Property("Street") - .HasColumnName("street") - .HasColumnType("text"); - - b1.HasKey("BranchOfficeId") - .HasName("pk_branch_office"); - - b1.ToTable("branch_office"); - - b1.WithOwner() - .HasForeignKey("BranchOfficeId") - .HasConstraintName("fk_address_branch_office_branch_office_id"); - }); - }); - - modelBuilder.Entity("Internship.Core.Intern", b => - { - b.HasOne("Internship.Core.Course", "Course") - .WithMany() - .HasForeignKey("CourseId") - .HasConstraintName("fk_interns_course_course_id"); - }); - - modelBuilder.Entity("Internship.Core.InternshipEntity", b => - { - b.HasOne("Internship.Core.BranchOffice", "BranchOffice") - .WithMany() - .HasForeignKey("BranchOfficeId") - .HasConstraintName("fk_internships_branch_office_branch_office_id"); - - b.HasOne("Internship.Core.Edition", "Edition") - .WithMany() - .HasForeignKey("EditionId") - .HasConstraintName("fk_internships_editions_edition_id"); - - b.HasOne("Internship.Core.Intern", "Intern") - .WithMany() - .HasForeignKey("InternAlbumNumber") - .HasConstraintName("fk_internships_interns_intern_album_number"); - - b.HasOne("Internship.Core.Report", "Report") - .WithMany() - .HasForeignKey("ReportId") - .HasConstraintName("fk_internships_reports_report_id"); - - b.OwnsOne("Internship.Core.DeanAcceptance", "DeanAcceptance", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("AcceptanceDate") - .HasColumnName("acceptance_date") - .HasColumnType("timestamp without time zone"); - - b1.Property("IsDeansAcceptanceRequired") - .HasColumnName("is_deans_acceptance_required") - .HasColumnType("boolean"); - - b1.Property("Reason") - .HasColumnName("reason") - .HasColumnType("integer"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_dean_acceptance_internships_internship_entity_id"); - }); - - b.OwnsOne("Internship.Core.Insurance", "Insurance", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("InsuranceDeliveryDate") - .HasColumnName("insurance_delivery_date") - .HasColumnType("timestamp without time zone"); - - b1.Property("IsInsuranceRequired") - .HasColumnName("is_insurance_required") - .HasColumnType("boolean"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_insurance_internships_internship_entity_id"); - }); - - b.OwnsOne("Internship.Core.Mentor", "Mentor", b1 => - { - b1.Property("InternshipEntityId") - .ValueGeneratedOnAdd() - .HasColumnName("id") - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b1.Property("Emali") - .HasColumnName("emali") - .HasColumnType("text"); - - b1.Property("Name") - .HasColumnName("name") - .HasColumnType("text"); - - b1.Property("Phone") - .HasColumnName("phone") - .HasColumnType("text"); - - b1.Property("Surname") - .HasColumnName("surname") - .HasColumnType("text"); - - b1.HasKey("InternshipEntityId") - .HasName("pk_internships"); - - b1.ToTable("internships"); - - b1.WithOwner() - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_mentor_internships_internship_entity_id"); - }); - }); - - modelBuilder.Entity("Internship.Core.InternshipProgramSubject", b => - { - b.HasOne("Internship.Core.Course", "Course") - .WithMany() - .HasForeignKey("CourseId") - .HasConstraintName("fk_internship_program_subject_course_course_id"); - - b.HasOne("Internship.Core.Edition", null) - .WithMany("Subjects") - .HasForeignKey("EditionId") - .HasConstraintName("fk_internship_program_subject_editions_edition_id"); - - b.HasOne("Internship.Core.InternshipEntity", null) - .WithMany("Program") - .HasForeignKey("InternshipEntityId") - .HasConstraintName("fk_internship_program_subject_internships_internship_entity_id"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Internship.Api/.dockerignore b/src/InternshipSystem.Api/.dockerignore similarity index 100% rename from src/Internship.Api/.dockerignore rename to src/InternshipSystem.Api/.dockerignore diff --git a/src/InternshipSystem.Api/Controllers/InternshipController.cs b/src/InternshipSystem.Api/Controllers/InternshipController.cs new file mode 100644 index 0000000..78bf017 --- /dev/null +++ b/src/InternshipSystem.Api/Controllers/InternshipController.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.AspNetCore.Mvc; +using InternshipSystem.Core; + +namespace InternshipSystem.Api.Controllers { + + [ApiController] + //[Route("[internship]")] + public class InternshipController : ControllerBase { + + [HttpGet] + public IActionResult GetInternships() { + //TODO: parse params + //return JsonResult(""); + return Ok(); + } + + [HttpPost] + public IActionResult CreateInternship(Internship internship) { + //TODO: add internship + return Ok(); + } + + + } +} \ No newline at end of file diff --git a/src/Internship.Api/Dockerfile b/src/InternshipSystem.Api/Dockerfile similarity index 100% rename from src/Internship.Api/Dockerfile rename to src/InternshipSystem.Api/Dockerfile diff --git a/src/Internship.Api/Internship.Api.csproj b/src/InternshipSystem.Api/InternshipSystem.Api.csproj similarity index 85% rename from src/Internship.Api/Internship.Api.csproj rename to src/InternshipSystem.Api/InternshipSystem.Api.csproj index cb39023..614c92a 100644 --- a/src/Internship.Api/Internship.Api.csproj +++ b/src/InternshipSystem.Api/InternshipSystem.Api.csproj @@ -17,4 +17,8 @@ + + + + diff --git a/src/Internship.Api/Program.cs b/src/InternshipSystem.Api/Program.cs similarity index 96% rename from src/Internship.Api/Program.cs rename to src/InternshipSystem.Api/Program.cs index 35b70dd..098ffb8 100644 --- a/src/Internship.Api/Program.cs +++ b/src/InternshipSystem.Api/Program.cs @@ -10,7 +10,7 @@ using Serilog; using Serilog.Events; using Serilog.Formatting.Compact; -namespace Internship.Api +namespace InternshipSystem.Api { public class Program { diff --git a/src/Internship.Api/Properties/launchSettings.json b/src/InternshipSystem.Api/Properties/launchSettings.json similarity index 100% rename from src/Internship.Api/Properties/launchSettings.json rename to src/InternshipSystem.Api/Properties/launchSettings.json diff --git a/src/Internship.Api/Startup.cs b/src/InternshipSystem.Api/Startup.cs similarity index 97% rename from src/Internship.Api/Startup.cs rename to src/InternshipSystem.Api/Startup.cs index e623c47..59c50c1 100644 --- a/src/Internship.Api/Startup.cs +++ b/src/InternshipSystem.Api/Startup.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; -namespace Internship.Api +namespace InternshipSystem.Api { public class Startup { diff --git a/src/Internship.Api/appsettings.Development.json b/src/InternshipSystem.Api/appsettings.Development.json similarity index 100% rename from src/Internship.Api/appsettings.Development.json rename to src/InternshipSystem.Api/appsettings.Development.json diff --git a/src/Internship.Api/appsettings.json b/src/InternshipSystem.Api/appsettings.json similarity index 100% rename from src/Internship.Api/appsettings.json rename to src/InternshipSystem.Api/appsettings.json diff --git a/src/Internship.Core/Address.cs b/src/InternshipSystem.Core/Address.cs similarity index 88% rename from src/Internship.Core/Address.cs rename to src/InternshipSystem.Core/Address.cs index 5ae6157..95b2dcc 100644 --- a/src/Internship.Core/Address.cs +++ b/src/InternshipSystem.Core/Address.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public class Address { diff --git a/src/Internship.Core/BranchOffice.cs b/src/InternshipSystem.Core/BranchOffice.cs similarity index 85% rename from src/Internship.Core/BranchOffice.cs rename to src/InternshipSystem.Core/BranchOffice.cs index 676c257..c30610f 100644 --- a/src/Internship.Core/BranchOffice.cs +++ b/src/InternshipSystem.Core/BranchOffice.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public class BranchOffice { diff --git a/src/Internship.Core/Company.cs b/src/InternshipSystem.Core/Company.cs similarity index 92% rename from src/Internship.Core/Company.cs rename to src/InternshipSystem.Core/Company.cs index 3b11a4b..d99b861 100644 --- a/src/Internship.Core/Company.cs +++ b/src/InternshipSystem.Core/Company.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Internship.Core +namespace InternshipSystem.Core { public class Company { diff --git a/src/Internship.Core/Course.cs b/src/InternshipSystem.Core/Course.cs similarity index 76% rename from src/Internship.Core/Course.cs rename to src/InternshipSystem.Core/Course.cs index 5e99801..4797e1a 100644 --- a/src/Internship.Core/Course.cs +++ b/src/InternshipSystem.Core/Course.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public class Course { diff --git a/src/Internship.Core/DeanAcceptance.cs b/src/InternshipSystem.Core/DeanAcceptance.cs similarity index 91% rename from src/Internship.Core/DeanAcceptance.cs rename to src/InternshipSystem.Core/DeanAcceptance.cs index 8ea1c72..55c0e7c 100644 --- a/src/Internship.Core/DeanAcceptance.cs +++ b/src/InternshipSystem.Core/DeanAcceptance.cs @@ -1,6 +1,6 @@ using System; -namespace Internship.Core +namespace InternshipSystem.Core { public class DeanAcceptance { diff --git a/src/Internship.Core/Edition.cs b/src/InternshipSystem.Core/Edition.cs similarity index 91% rename from src/Internship.Core/Edition.cs rename to src/InternshipSystem.Core/Edition.cs index 46988eb..60db76f 100644 --- a/src/Internship.Core/Edition.cs +++ b/src/InternshipSystem.Core/Edition.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Internship.Core +namespace InternshipSystem.Core { public class Edition { diff --git a/src/Internship.Core/Insurance.cs b/src/InternshipSystem.Core/Insurance.cs similarity index 84% rename from src/Internship.Core/Insurance.cs rename to src/InternshipSystem.Core/Insurance.cs index 0315e2e..2306d9e 100644 --- a/src/Internship.Core/Insurance.cs +++ b/src/InternshipSystem.Core/Insurance.cs @@ -1,6 +1,6 @@ using System; -namespace Internship.Core +namespace InternshipSystem.Core { public class Insurance { diff --git a/src/Internship.Core/Intern.cs b/src/InternshipSystem.Core/Intern.cs similarity index 90% rename from src/Internship.Core/Intern.cs rename to src/InternshipSystem.Core/Intern.cs index 6f65c68..f9297e6 100644 --- a/src/Internship.Core/Intern.cs +++ b/src/InternshipSystem.Core/Intern.cs @@ -1,6 +1,6 @@ using System; -namespace Internship.Core +namespace InternshipSystem.Core { public class Intern { diff --git a/src/Internship.Core/InternshipEntity.cs b/src/InternshipSystem.Core/Internship.cs similarity index 92% rename from src/Internship.Core/InternshipEntity.cs rename to src/InternshipSystem.Core/Internship.cs index 212b0ff..582be5d 100644 --- a/src/Internship.Core/InternshipEntity.cs +++ b/src/InternshipSystem.Core/Internship.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -namespace Internship.Core +namespace InternshipSystem.Core { - public class InternshipEntity + public class Internship { public int Id { get; set; } public Intern Intern { get; set; } diff --git a/src/Internship.Core/InternshipProgramSubject.cs b/src/InternshipSystem.Core/InternshipProgramSubject.cs similarity index 84% rename from src/Internship.Core/InternshipProgramSubject.cs rename to src/InternshipSystem.Core/InternshipProgramSubject.cs index 2d9124d..9904ac1 100644 --- a/src/Internship.Core/InternshipProgramSubject.cs +++ b/src/InternshipSystem.Core/InternshipProgramSubject.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public class InternshipProgramSubject { diff --git a/src/Internship.Core/Internship.Core.csproj b/src/InternshipSystem.Core/InternshipSystem.Core.csproj similarity index 100% rename from src/Internship.Core/Internship.Core.csproj rename to src/InternshipSystem.Core/InternshipSystem.Core.csproj diff --git a/src/Internship.Core/InternshipType.cs b/src/InternshipSystem.Core/InternshipType.cs similarity index 88% rename from src/Internship.Core/InternshipType.cs rename to src/InternshipSystem.Core/InternshipType.cs index 90142e6..826e4f8 100644 --- a/src/Internship.Core/InternshipType.cs +++ b/src/InternshipSystem.Core/InternshipType.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public enum InternshipType { diff --git a/src/Internship.Core/Mentor.cs b/src/InternshipSystem.Core/Mentor.cs similarity index 86% rename from src/Internship.Core/Mentor.cs rename to src/InternshipSystem.Core/Mentor.cs index 6b49ce6..b1fc801 100644 --- a/src/Internship.Core/Mentor.cs +++ b/src/InternshipSystem.Core/Mentor.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public class Mentor { public string Name { get; set; } diff --git a/src/Internship.Core/RangeOfActivities.cs b/src/InternshipSystem.Core/RangeOfActivities.cs similarity index 74% rename from src/Internship.Core/RangeOfActivities.cs rename to src/InternshipSystem.Core/RangeOfActivities.cs index 86cfc7a..84da216 100644 --- a/src/Internship.Core/RangeOfActivities.cs +++ b/src/InternshipSystem.Core/RangeOfActivities.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public enum RangeOfActivities { diff --git a/src/Internship.Core/Report.cs b/src/InternshipSystem.Core/Report.cs similarity index 68% rename from src/Internship.Core/Report.cs rename to src/InternshipSystem.Core/Report.cs index 3a8c42d..9835b76 100644 --- a/src/Internship.Core/Report.cs +++ b/src/InternshipSystem.Core/Report.cs @@ -1,4 +1,4 @@ -namespace Internship.Core +namespace InternshipSystem.Core { public class Report { diff --git a/src/Internship.Repository/InternshipDbContext.cs b/src/InternshipSystem.Repository/InternshipDbContext.cs similarity index 87% rename from src/Internship.Repository/InternshipDbContext.cs rename to src/InternshipSystem.Repository/InternshipDbContext.cs index 9af3eaa..4ddc481 100644 --- a/src/Internship.Repository/InternshipDbContext.cs +++ b/src/InternshipSystem.Repository/InternshipDbContext.cs @@ -1,11 +1,11 @@ using Microsoft.EntityFrameworkCore; -using Internship.Core; +using InternshipSystem.Core; -namespace Internship.Repository +namespace InternshipSystem.Repository { public class InternshipDbContext : DbContext { - public DbSet Internships { get; set; } + public DbSet Internships { get; set; } public DbSet Companies { get; set; } public DbSet Editions { get; set; } public DbSet Reports { get; set; } @@ -17,7 +17,7 @@ namespace Internship.Repository protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder - .Entity(ie => { + .Entity(ie => { ie.OwnsOne(i => i.DeanAcceptance); ie.OwnsOne(i => i.Insurance); ie.OwnsOne(i => i.Mentor); diff --git a/src/Internship.Repository/Internship.Repository.csproj b/src/InternshipSystem.Repository/InternshipSystem.Repository.csproj similarity index 89% rename from src/Internship.Repository/Internship.Repository.csproj rename to src/InternshipSystem.Repository/InternshipSystem.Repository.csproj index 00bc49b..4b21438 100644 --- a/src/Internship.Repository/Internship.Repository.csproj +++ b/src/InternshipSystem.Repository/InternshipSystem.Repository.csproj @@ -16,7 +16,7 @@ - + diff --git a/test/Internship.Api.Test/Internship.Api.Test.csproj b/test/InternshipSystem.Api.Test/InternshipSystem.Api.Test.csproj similarity index 100% rename from test/Internship.Api.Test/Internship.Api.Test.csproj rename to test/InternshipSystem.Api.Test/InternshipSystem.Api.Test.csproj diff --git a/test/Internship.Api.Test/InternshipTests.cs b/test/InternshipSystem.Api.Test/InternshipSystem.cs similarity index 57% rename from test/Internship.Api.Test/InternshipTests.cs rename to test/InternshipSystem.Api.Test/InternshipSystem.cs index b9e9970..b490e1d 100644 --- a/test/Internship.Api.Test/InternshipTests.cs +++ b/test/InternshipSystem.Api.Test/InternshipSystem.cs @@ -1,6 +1,6 @@ using System; using Machine.Specifications; -namespace Internship.Api.Test +namespace InternshipSystem.Api.Test { } diff --git a/test/Internship.Core.Tests/Internship.Core.Tests.csproj b/test/InternshipSystem.Core.Tests/InternshipSystem.Core.Tests.csproj similarity index 88% rename from test/Internship.Core.Tests/Internship.Core.Tests.csproj rename to test/InternshipSystem.Core.Tests/InternshipSystem.Core.Tests.csproj index daba101..1977a73 100644 --- a/test/Internship.Core.Tests/Internship.Core.Tests.csproj +++ b/test/InternshipSystem.Core.Tests/InternshipSystem.Core.Tests.csproj @@ -16,7 +16,7 @@ - + diff --git a/test/Internship.Core.Tests/Internship.Test.cs b/test/InternshipSystem.Core.Tests/InternshipSystem.Test.cs similarity index 79% rename from test/Internship.Core.Tests/Internship.Test.cs rename to test/InternshipSystem.Core.Tests/InternshipSystem.Test.cs index 4f1c973..be2882e 100644 --- a/test/Internship.Core.Tests/Internship.Test.cs +++ b/test/InternshipSystem.Core.Tests/InternshipSystem.Test.cs @@ -2,9 +2,9 @@ using System; using Machine.Specifications; // ReSharper disable InconsistentNaming -namespace Internship.Core.Tests +namespace InternshipSystem.Core.Tests { - [Subject(typeof(InternshipEntity))] + [Subject(typeof(Internship))] class When_doing_something { Establish context = () => { };