diff --git a/ConsoleApp/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..2082704 --- /dev/null +++ b/ConsoleApp/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,8 @@ + + + + Exe + net5.0 + + + diff --git a/ConsoleApp/ConsoleApp1/Program.cs b/ConsoleApp/ConsoleApp1/Program.cs new file mode 100644 index 0000000..76e36ae --- /dev/null +++ b/ConsoleApp/ConsoleApp1/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/Controllers/FieldController.cs b/WebApi/Controllers/FieldController.cs similarity index 100% rename from Controllers/FieldController.cs rename to WebApi/Controllers/FieldController.cs diff --git a/Controllers/WeatherForecastController.cs b/WebApi/Controllers/WeatherForecastController.cs similarity index 100% rename from Controllers/WeatherForecastController.cs rename to WebApi/Controllers/WeatherForecastController.cs diff --git a/Model/Field.cs b/WebApi/Model/Field.cs similarity index 100% rename from Model/Field.cs rename to WebApi/Model/Field.cs diff --git a/Model/FieldManager.cs b/WebApi/Model/FieldManager.cs similarity index 100% rename from Model/FieldManager.cs rename to WebApi/Model/FieldManager.cs diff --git a/Model/Figure.cs b/WebApi/Model/Figure.cs similarity index 100% rename from Model/Figure.cs rename to WebApi/Model/Figure.cs diff --git a/Model/FigureMover.cs b/WebApi/Model/FigureMover.cs similarity index 100% rename from Model/FigureMover.cs rename to WebApi/Model/FigureMover.cs diff --git a/Model/IFieldManager.cs b/WebApi/Model/IFieldManager.cs similarity index 100% rename from Model/IFieldManager.cs rename to WebApi/Model/IFieldManager.cs diff --git a/Model/RandomField.cs b/WebApi/Model/RandomField.cs similarity index 100% rename from Model/RandomField.cs rename to WebApi/Model/RandomField.cs diff --git a/Program.cs b/WebApi/Program.cs similarity index 100% rename from Program.cs rename to WebApi/Program.cs diff --git a/Properties/launchSettings.json b/WebApi/Properties/launchSettings.json similarity index 100% rename from Properties/launchSettings.json rename to WebApi/Properties/launchSettings.json diff --git a/Startup.cs b/WebApi/Startup.cs similarity index 96% rename from Startup.cs rename to WebApi/Startup.cs index 2fd1b19..f3048f7 100644 --- a/Startup.cs +++ b/WebApi/Startup.cs @@ -29,7 +29,7 @@ namespace WebApplication1 services.AddControllers(); - services.AddSingleton(new FieldManager()); + services.AddSingleton(); services.AddSwaggerGen(c => { diff --git a/TextFile.md b/WebApi/TextFile.md similarity index 100% rename from TextFile.md rename to WebApi/TextFile.md diff --git a/WeatherForecast.cs b/WebApi/WeatherForecast.cs similarity index 100% rename from WeatherForecast.cs rename to WebApi/WeatherForecast.cs diff --git a/WebApplication1.csproj b/WebApi/WebApplication1.csproj similarity index 100% rename from WebApplication1.csproj rename to WebApi/WebApplication1.csproj diff --git a/WebApplication1.csproj.user b/WebApi/WebApplication1.csproj.user similarity index 100% rename from WebApplication1.csproj.user rename to WebApi/WebApplication1.csproj.user diff --git a/WebApi/WebApplication1.sln b/WebApi/WebApplication1.sln new file mode 100644 index 0000000..286708b --- /dev/null +++ b/WebApi/WebApplication1.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30709.132 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApplication1", "WebApplication1.csproj", "{1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "..\ConsoleApp2\ConsoleApp2.csproj", "{95D5C921-BDC7-4A88-AAAD-EF09B81221EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Release|Any CPU.Build.0 = Release|Any CPU + {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F485B05F-F662-4D8B-8E28-EB57AA152B44} + EndGlobalSection +EndGlobal diff --git a/appsettings.Development.json b/WebApi/appsettings.Development.json similarity index 100% rename from appsettings.Development.json rename to WebApi/appsettings.Development.json diff --git a/appsettings.json b/WebApi/appsettings.json similarity index 100% rename from appsettings.json rename to WebApi/appsettings.json diff --git a/WebApplication1.sln b/WebApplication1.sln index 286708b..9ad0f2e 100644 --- a/WebApplication1.sln +++ b/WebApplication1.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30709.132 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApplication1", "WebApplication1.csproj", "{1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp\ConsoleApp1\ConsoleApp1.csproj", "{1135BD61-853A-47CB-BBC0-F6A3418FE133}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "..\ConsoleApp2\ConsoleApp2.csproj", "{95D5C921-BDC7-4A88-AAAD-EF09B81221EF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication1", "WebApi\WebApplication1.csproj", "{C01D1569-5E0A-415B-838B-5E528DFF37AC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,14 +13,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E41DB1E-938D-4030-B8C7-B90C64A7B6CC}.Release|Any CPU.Build.0 = Release|Any CPU - {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95D5C921-BDC7-4A88-AAAD-EF09B81221EF}.Release|Any CPU.Build.0 = Release|Any CPU + {1135BD61-853A-47CB-BBC0-F6A3418FE133}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1135BD61-853A-47CB-BBC0-F6A3418FE133}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1135BD61-853A-47CB-BBC0-F6A3418FE133}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1135BD61-853A-47CB-BBC0-F6A3418FE133}.Release|Any CPU.Build.0 = Release|Any CPU + {C01D1569-5E0A-415B-838B-5E528DFF37AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C01D1569-5E0A-415B-838B-5E528DFF37AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C01D1569-5E0A-415B-838B-5E528DFF37AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C01D1569-5E0A-415B-838B-5E528DFF37AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/swagger.json b/swagger.json new file mode 100644 index 0000000..61e49a1 --- /dev/null +++ b/swagger.json @@ -0,0 +1,222 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "WebApplication1", + "version": "v1" + }, + "paths": { + "/api/v1/Field/new": { + "post": { + "tags": [ + "Field" + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/Field" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Field" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/Field" + } + } + } + } + } + } + }, + "/api/v1/Field/move": { + "post": { + "tags": [ + "Field" + ], + "parameters": [ + { + "name": "identifier", + "in": "query", + "schema": { + "type": "string", + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/Field" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Field" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/Field" + } + } + } + } + } + } + }, + "/api/v1/Field/list": { + "get": { + "tags": [ + "Field" + ], + "parameters": [ + { + "name": "identifier", + "in": "query", + "schema": { + "type": "string", + "nullable": true + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/Field" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/Field" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/Field" + } + } + } + } + } + } + }, + "/WeatherForecast": { + "get": { + "tags": [ + "WeatherForecast" + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WeatherForecast" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WeatherForecast" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WeatherForecast" + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Figure": { + "type": "object", + "properties": { + "figureColor": { + "type": "integer", + "format": "int32" + }, + "figureType": { + "type": "integer", + "format": "int32" + }, + "posX": { + "type": "integer", + "format": "int32" + }, + "posY": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + }, + "Field": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "nullable": true, + "readOnly": true + }, + "figures": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Figure" + }, + "nullable": true, + "readOnly": true + } + }, + "additionalProperties": false + }, + "WeatherForecast": { + "type": "object", + "properties": { + "date": { + "type": "string", + "format": "date-time" + }, + "temperatureC": { + "type": "integer", + "format": "int32" + }, + "temperatureF": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "summaryWeather": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file