From 0315a46587ae78af5da5ecbb9952b6a99774849d Mon Sep 17 00:00:00 2001 From: Maxchil Date: Fri, 12 Jun 2020 16:06:45 +0200 Subject: [PATCH 1/2] ide configuration changes, add postgre to compose --- .docker/docker-compose.debug.yml | 10 ++++++ .docker/docker-compose.yaml | 21 ++++++++----- .dockerignore | 24 +++++++++++++++ .vscode/launch.json | 52 +++++++++++++++----------------- .vscode/settings.json | 6 ++++ .vscode/tasks.json | 23 +++++++++++++- global.json | 2 +- src/Internship.Api/.dockerignore | 2 -- 8 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 .docker/docker-compose.debug.yml create mode 100644 .dockerignore create mode 100644 .vscode/settings.json delete mode 100644 src/Internship.Api/.dockerignore diff --git a/.docker/docker-compose.debug.yml b/.docker/docker-compose.debug.yml new file mode 100644 index 0000000..ce5fa67 --- /dev/null +++ b/.docker/docker-compose.debug.yml @@ -0,0 +1,10 @@ +# Please refer https://aka.ms/HTTPSinContainer on how to setup an https developer certificate for your ASP .NET Core service. +version: '3.4' + +services: + internship.api: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://+:80 + volumes: + - ~/.vsdbg:/remote_debugger:rw diff --git a/.docker/docker-compose.yaml b/.docker/docker-compose.yaml index 06af3a6..6d84647 100644 --- a/.docker/docker-compose.yaml +++ b/.docker/docker-compose.yaml @@ -1,9 +1,16 @@ version: "3.3" services: - - internship.api: - image: internship.api:latest - build: ../src/Internship.Api - ports: - - 8080:80 - \ No newline at end of file + + internship.api: + image: internship.api:latest + build: ../src/Internship.Api + ports: + - 8080:80 + + db.postgres: + image: postgres + restart: always + environment: + POSTGRES_PASSWORD: szwoniu + ports: + - 5432:5432 \ No newline at end of file diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..257cb48 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 1d4bc6e..15cdbfd 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,33 +4,31 @@ // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md "version": "0.2.0", "configurations": [ - { - "name": ".NET Core Launch (web)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/Internship.Api/bin/Debug/netcoreapp3.1/Internship.Api.dll", - "args": [], - "cwd": "${workspaceFolder}/src/Internship.Api", - "stopAtEntry": false, - // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser - "serverReadyAction": { - "action": "openExternally", - "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" - }, - "env": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "sourceFileMap": { - "/Views": "${workspaceFolder}/Views" - } + { + "name": ".NET Core Launch (web)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/Internship.Api/bin/Debug/netcoreapp3.1/Internship.Api.dll", + "args": [], + "cwd": "${workspaceFolder}/src/Internship.Api", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach", - "processId": "${command:pickProcess}" + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "sourceFileMap": { + "/Views": "${workspaceFolder}/Views" } - ] + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } +] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9ff8d37 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.exclude": { + "**/bin": true, + "**/obj": true + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a954e09..92fcc64 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -37,6 +37,27 @@ "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" - } + }, + { + "label": "up", + "type": "shell", + "command": "docker-compose", + "args": [ + "-f", + ".docker/docker-compose.yaml", + "up", + "--build" + ], + "problemMatcher": [] + }, + { + "label": "dotnet restore", + "type": "shell", + "command": "dotnet", + "args": [ + "restore" + ], + "problemMatcher": [] + }, ] } \ No newline at end of file diff --git a/global.json b/global.json index cc4d115..65cf76e 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.1.200" + "version": "3.1.103" } } \ No newline at end of file diff --git a/src/Internship.Api/.dockerignore b/src/Internship.Api/.dockerignore deleted file mode 100644 index a02c9ed..0000000 --- a/src/Internship.Api/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -bin\ -obj\ \ No newline at end of file -- 2.45.2 From e03e6789486d7ff4bedc500bc21ccc8678762356 Mon Sep 17 00:00:00 2001 From: Maxchil Date: Fri, 12 Jun 2020 16:09:48 +0200 Subject: [PATCH 2/2] change model according to request, add Ids --- 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 = () => { }; -- 2.45.2