From d234246248298a77e016f0a84f7cc597dc7c0419 Mon Sep 17 00:00:00 2001 From: maxchil Date: Fri, 12 Jun 2020 16:51:28 +0200 Subject: [PATCH] improve model based on IPP form and add ids to entities (#8) Merge branch 'master' of http://git.kadet.net/system-praktyk/system-praktyk-api into feat/improve_model change model according to request, add Ids ide configuration changes, add postgre to compose Co-authored-by: Maxchil --- src/Internship.Api/Startup.cs | 7 ------- src/Internship.Core/Address.cs | 2 +- src/Internship.Core/BranchOffice.cs | 4 +++- src/Internship.Core/Company.cs | 5 ++++- src/Internship.Core/Course.cs | 2 ++ src/Internship.Core/DeanAcceptance.cs | 2 +- src/Internship.Core/Edition.cs | 4 +++- src/Internship.Core/Insurance.cs | 2 +- .../{Internship.cs => InternshipEntity.cs} | 8 +++++--- src/Internship.Core/InternshipProgram.cs | 6 ------ src/Internship.Core/InternshipProgramSubject.cs | 9 +++++++++ src/Internship.Core/InternshipType.cs | 10 ++++++++-- src/Internship.Core/RangeOfActivities.cs | 3 +++ src/Internship.Core/Report.cs | 1 + src/Internship.Repository/Class1.cs | 8 -------- test/Internship.Core.Tests/Internship.Test.cs | 2 +- 16 files changed, 42 insertions(+), 33 deletions(-) rename src/Internship.Core/{Internship.cs => InternshipEntity.cs} (73%) delete mode 100644 src/Internship.Core/InternshipProgram.cs create mode 100644 src/Internship.Core/InternshipProgramSubject.cs delete mode 100644 src/Internship.Repository/Class1.cs diff --git a/src/Internship.Api/Startup.cs b/src/Internship.Api/Startup.cs index e3b1a79..e623c47 100644 --- a/src/Internship.Api/Startup.cs +++ b/src/Internship.Api/Startup.cs @@ -1,15 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; namespace Internship.Api diff --git a/src/Internship.Core/Address.cs b/src/Internship.Core/Address.cs index d921e9b..5ae6157 100644 --- a/src/Internship.Core/Address.cs +++ b/src/Internship.Core/Address.cs @@ -1,6 +1,6 @@ namespace Internship.Core { - public struct Address + public class Address { public string Street { get; set; } public string Building { get; set; } diff --git a/src/Internship.Core/BranchOffice.cs b/src/Internship.Core/BranchOffice.cs index 3f0c80d..676c257 100644 --- a/src/Internship.Core/BranchOffice.cs +++ b/src/Internship.Core/BranchOffice.cs @@ -2,7 +2,9 @@ { public class BranchOffice { - public Company Company { get; set; } + public int Id { get; set; } public Address Address { get; set; } + public Company Company { get; set; } + public int Provider { get; set; } } } \ No newline at end of file diff --git a/src/Internship.Core/Company.cs b/src/Internship.Core/Company.cs index 57cf9dd..3b11a4b 100644 --- a/src/Internship.Core/Company.cs +++ b/src/Internship.Core/Company.cs @@ -1,12 +1,15 @@ using System; +using System.Collections.Generic; namespace Internship.Core { public class Company { + public string Nip { get; set; } public string Name { get; set; } public RangeOfActivities Range { get; set; } public Uri SiteAddress { get; set; } - public string Nip { get; set; } + public int Provider { get; set; } + public List Branches { get; set; } } } \ No newline at end of file diff --git a/src/Internship.Core/Course.cs b/src/Internship.Core/Course.cs index 44e9c1d..5e99801 100644 --- a/src/Internship.Core/Course.cs +++ b/src/Internship.Core/Course.cs @@ -2,5 +2,7 @@ { public class Course { + public int Id { get; set; } + public string Name { get; set; } } } \ No newline at end of file diff --git a/src/Internship.Core/DeanAcceptance.cs b/src/Internship.Core/DeanAcceptance.cs index 0eec430..8ea1c72 100644 --- a/src/Internship.Core/DeanAcceptance.cs +++ b/src/Internship.Core/DeanAcceptance.cs @@ -2,7 +2,7 @@ namespace Internship.Core { - public struct DeanAcceptance + public class DeanAcceptance { public DateTime AcceptanceDate { get; set; } public bool IsDeansAcceptanceRequired { get; set; } diff --git a/src/Internship.Core/Edition.cs b/src/Internship.Core/Edition.cs index 8d6c6ac..46988eb 100644 --- a/src/Internship.Core/Edition.cs +++ b/src/Internship.Core/Edition.cs @@ -1,12 +1,14 @@ using System; +using System.Collections.Generic; namespace Internship.Core { public class Edition { + public int Id { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public DateTime IPPDeadlineDate { get; set; } - + public List Subjects { get; set;} } } \ No newline at end of file diff --git a/src/Internship.Core/Insurance.cs b/src/Internship.Core/Insurance.cs index e74cf57..0315e2e 100644 --- a/src/Internship.Core/Insurance.cs +++ b/src/Internship.Core/Insurance.cs @@ -2,7 +2,7 @@ namespace Internship.Core { - public struct Insurance + public class Insurance { public DateTime InsuranceDeliveryDate { get; set; } public bool IsInsuranceRequired { get; set; } diff --git a/src/Internship.Core/Internship.cs b/src/Internship.Core/InternshipEntity.cs similarity index 73% rename from src/Internship.Core/Internship.cs rename to src/Internship.Core/InternshipEntity.cs index c876e7b..e74c312 100644 --- a/src/Internship.Core/Internship.cs +++ b/src/Internship.Core/InternshipEntity.cs @@ -1,21 +1,23 @@ using System; +using System.Collections.Generic; namespace Internship.Core { - public class Internship + public class InternshipEntity { + public int Id { get; set; } public Intern Intern { get; set; } public Edition Edition { get; set; } public Report Report { get; set; } public BranchOffice BranchOffice { get; set; } - public InternshipProgram Program { get; set; } public InternshipType Type { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public bool IsAccepted { get; set; } public DeanAcceptance DeanAcceptance { get; set; } public Insurance Insurance { get; set; } - public int InternshipLengthInWeeks { get; set; } + public float Grade { get; set; } + public List Program { get; set; } } } \ No newline at end of file diff --git a/src/Internship.Core/InternshipProgram.cs b/src/Internship.Core/InternshipProgram.cs deleted file mode 100644 index b70d0de..0000000 --- a/src/Internship.Core/InternshipProgram.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Internship.Core -{ - public class InternshipProgram - { - } -} \ No newline at end of file diff --git a/src/Internship.Core/InternshipProgramSubject.cs b/src/Internship.Core/InternshipProgramSubject.cs new file mode 100644 index 0000000..2d9124d --- /dev/null +++ b/src/Internship.Core/InternshipProgramSubject.cs @@ -0,0 +1,9 @@ +namespace Internship.Core +{ + public class InternshipProgramSubject + { + public int Id { get; set; } + public Course Course { get; set; } + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/src/Internship.Core/InternshipType.cs b/src/Internship.Core/InternshipType.cs index 8fb9258..936720f 100644 --- a/src/Internship.Core/InternshipType.cs +++ b/src/Internship.Core/InternshipType.cs @@ -2,7 +2,13 @@ { public enum InternshipType { - B2B, - Free + Other, + FreeInternship, + GraduateInternship, + FreeApprenticeship, + PaidApprenticeship, + EmploymentContract, + MandateContract, + ContractWork } } \ No newline at end of file diff --git a/src/Internship.Core/RangeOfActivities.cs b/src/Internship.Core/RangeOfActivities.cs index b3ff198..86cfc7a 100644 --- a/src/Internship.Core/RangeOfActivities.cs +++ b/src/Internship.Core/RangeOfActivities.cs @@ -2,5 +2,8 @@ { public enum RangeOfActivities { + Other, + National, + International } } \ No newline at end of file diff --git a/src/Internship.Core/Report.cs b/src/Internship.Core/Report.cs index 805ffe9..3a8c42d 100644 --- a/src/Internship.Core/Report.cs +++ b/src/Internship.Core/Report.cs @@ -2,5 +2,6 @@ { public class Report { + public int Id { get; set; } } } \ No newline at end of file diff --git a/src/Internship.Repository/Class1.cs b/src/Internship.Repository/Class1.cs deleted file mode 100644 index c57d5fa..0000000 --- a/src/Internship.Repository/Class1.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Internship.Repository -{ - public class Class1 - { - } -} diff --git a/test/Internship.Core.Tests/Internship.Test.cs b/test/Internship.Core.Tests/Internship.Test.cs index e91587b..4f1c973 100644 --- a/test/Internship.Core.Tests/Internship.Test.cs +++ b/test/Internship.Core.Tests/Internship.Test.cs @@ -4,7 +4,7 @@ using Machine.Specifications; namespace Internship.Core.Tests { - [Subject(typeof(Internship))] + [Subject(typeof(InternshipEntity))] class When_doing_something { Establish context = () => { };