From 3faf7264f93da2d513a9bc7d1e805743a694200a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=AF=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=B2?= Date: Sun, 26 May 2024 16:27:14 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D1=83=20rest=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ServiceStation/ServiceStation.sln | 8 ++- .../Controllers/MainController.cs | 11 ++++ .../Controllers/ReportController.cs | 11 ++++ .../ServiceStationRestApi/Program.cs | 51 +++++++++++++++++++ .../Properties/launchSettings.json | 31 +++++++++++ .../ServiceStationRestApi.csproj | 20 ++++++++ .../appsettings.Development.json | 8 +++ .../ServiceStationRestApi/appsettings.json | 9 ++++ .../ServiceStationRestApi/log4net.config | 16 ++++++ 9 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 ServiceStation/ServiceStationRestApi/Controllers/MainController.cs create mode 100644 ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs create mode 100644 ServiceStation/ServiceStationRestApi/Program.cs create mode 100644 ServiceStation/ServiceStationRestApi/Properties/launchSettings.json create mode 100644 ServiceStation/ServiceStationRestApi/ServiceStationRestApi.csproj create mode 100644 ServiceStation/ServiceStationRestApi/appsettings.Development.json create mode 100644 ServiceStation/ServiceStationRestApi/appsettings.json create mode 100644 ServiceStation/ServiceStationRestApi/log4net.config diff --git a/ServiceStation/ServiceStation.sln b/ServiceStation/ServiceStation.sln index ad96807..2e7c6d5 100644 --- a/ServiceStation/ServiceStation.sln +++ b/ServiceStation/ServiceStation.sln @@ -15,7 +15,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationBusinessLogic EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationExecutorApp", "ServiceStationExecutorApp\ServiceStationExecutorApp.csproj", "{937B647F-2060-4352-87F0-8B230EC998F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStationGuarantorApp", "ServiceStationGuarantorApp\ServiceStationGuarantorApp.csproj", "{444BECA0-9537-436B-9DE2-7D22125406E6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceStationGuarantorApp", "ServiceStationGuarantorApp\ServiceStationGuarantorApp.csproj", "{444BECA0-9537-436B-9DE2-7D22125406E6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStationRestApi", "ServiceStationRestApi\ServiceStationRestApi.csproj", "{393E20E0-C17B-4AE0-9A54-5DF1805C9335}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -51,6 +53,10 @@ Global {444BECA0-9537-436B-9DE2-7D22125406E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {444BECA0-9537-436B-9DE2-7D22125406E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {444BECA0-9537-436B-9DE2-7D22125406E6}.Release|Any CPU.Build.0 = Release|Any CPU + {393E20E0-C17B-4AE0-9A54-5DF1805C9335}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {393E20E0-C17B-4AE0-9A54-5DF1805C9335}.Debug|Any CPU.Build.0 = Debug|Any CPU + {393E20E0-C17B-4AE0-9A54-5DF1805C9335}.Release|Any CPU.ActiveCfg = Release|Any CPU + {393E20E0-C17B-4AE0-9A54-5DF1805C9335}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs b/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs new file mode 100644 index 0000000..8eb19db --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/Controllers/MainController.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ServiceStationRestApi.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class MainController : Controller + { + + } +} diff --git a/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs b/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs new file mode 100644 index 0000000..ae1dd26 --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/Controllers/ReportController.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ServiceStationRestApi.Controllers +{ + [Route("api/[controller]/[action]")] + [ApiController] + public class ReportController : Controller + { + + } +} diff --git a/ServiceStation/ServiceStationRestApi/Program.cs b/ServiceStation/ServiceStationRestApi/Program.cs new file mode 100644 index 0000000..19b842c --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/Program.cs @@ -0,0 +1,51 @@ +using Microsoft.OpenApi.Models; +using ServiceStationBusinessLogic.BusinessLogics; +using ServiceStationContracts.BusinessLogicsContracts; +using ServiceStationContracts.StoragesContracts; +using ServiceStationDatabaseImplement.Implements; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Logging.SetMinimumLevel(LogLevel.Trace); +builder.Logging.AddLog4Net("log4net.config"); + +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo + { + Title = "ServiceStation", + Version = "v1" + }); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ServiceStation v1")); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/ServiceStation/ServiceStationRestApi/Properties/launchSettings.json b/ServiceStation/ServiceStationRestApi/Properties/launchSettings.json new file mode 100644 index 0000000..18daa9f --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:10546", + "sslPort": 44332 + } + }, + "profiles": { + "ServiceStationRestApi": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7288;http://localhost:5076", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/ServiceStation/ServiceStationRestApi/ServiceStationRestApi.csproj b/ServiceStation/ServiceStationRestApi/ServiceStationRestApi.csproj new file mode 100644 index 0000000..4e1a394 --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/ServiceStationRestApi.csproj @@ -0,0 +1,20 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + diff --git a/ServiceStation/ServiceStationRestApi/appsettings.Development.json b/ServiceStation/ServiceStationRestApi/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/ServiceStation/ServiceStationRestApi/appsettings.json b/ServiceStation/ServiceStationRestApi/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/ServiceStation/ServiceStationRestApi/log4net.config b/ServiceStation/ServiceStationRestApi/log4net.config new file mode 100644 index 0000000..228db20 --- /dev/null +++ b/ServiceStation/ServiceStationRestApi/log4net.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file