From 64e063b9a0074af20d147a64d13d1b54f1b36502 Mon Sep 17 00:00:00 2001 From: espent1004 Date: Sun, 27 Oct 2019 19:06:47 +0100 Subject: [PATCH] Adding tenantManger project --- docker-compose.override.yml | 8 ++ docker-compose.yml | 8 ++ eShopOnContainers-ServicesAndWebApps.sln | 114 ++++++++++++++- .../Controllers/CustomisationsController.cs | 106 ++++++++++++++ .../Controllers/MethodsController.cs | 106 ++++++++++++++ .../Controllers/TenantsController.cs | 105 ++++++++++++++ .../Controllers/ValuesController.cs | 45 ++++++ .../Data/TenantManagerContext.cs | 35 +++++ .../TenantManager/Database/DbInitializer.cs | 70 +++++++++ .../TenantManager/TenantManager/Dockerfile | 59 ++++++++ .../TenantManager/Models/Customisation.cs | 16 +++ .../TenantManager/Models/Methods.cs | 15 ++ .../TenantManager/Models/Tenant.cs | 16 +++ .../TenantManager/TenantManager/Program.cs | 44 ++++++ .../Properties/launchSettings.json | 42 ++++++ .../TenantManager/TenantManager/Startup.cs | 134 ++++++++++++++++++ .../TenantManager/TenantManager.csproj | 25 ++++ .../TenantManager/TenantManagerSettings.cs | 13 ++ .../appsettings.Development.json | 9 ++ .../TenantManager/appsettings.json | 9 ++ 20 files changed, 976 insertions(+), 3 deletions(-) create mode 100644 src/Services/TenantManager/TenantManager/Controllers/CustomisationsController.cs create mode 100644 src/Services/TenantManager/TenantManager/Controllers/MethodsController.cs create mode 100644 src/Services/TenantManager/TenantManager/Controllers/TenantsController.cs create mode 100644 src/Services/TenantManager/TenantManager/Controllers/ValuesController.cs create mode 100644 src/Services/TenantManager/TenantManager/Data/TenantManagerContext.cs create mode 100644 src/Services/TenantManager/TenantManager/Database/DbInitializer.cs create mode 100644 src/Services/TenantManager/TenantManager/Dockerfile create mode 100644 src/Services/TenantManager/TenantManager/Models/Customisation.cs create mode 100644 src/Services/TenantManager/TenantManager/Models/Methods.cs create mode 100644 src/Services/TenantManager/TenantManager/Models/Tenant.cs create mode 100644 src/Services/TenantManager/TenantManager/Program.cs create mode 100644 src/Services/TenantManager/TenantManager/Properties/launchSettings.json create mode 100644 src/Services/TenantManager/TenantManager/Startup.cs create mode 100644 src/Services/TenantManager/TenantManager/TenantManager.csproj create mode 100644 src/Services/TenantManager/TenantManager/TenantManagerSettings.cs create mode 100644 src/Services/TenantManager/TenantManager/appsettings.Development.json create mode 100644 src/Services/TenantManager/TenantManager/appsettings.json diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 1ec7879b3..41faa3580 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -49,12 +49,20 @@ services: - WebShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5121 - WebhooksApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5113 - WebhooksWebClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5114 + - TenantManagerApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5115 - UseCustomizationData=True - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} ports: - "5105:80" + tenantmanager: + environment: + - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.TenantManagerDb;User Id=sa;Password=Pass@word} + + ports: + - "5115:80" + basket.api: environment: - ASPNETCORE_ENVIRONMENT=Development diff --git a/docker-compose.yml b/docker-compose.yml index 6094f2ca2..abd837ec8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,14 @@ services: - identity.api - rabbitmq + tenantmanager: + image: ${REGISTRY:-eshop}/tenantmanager:${PLATFORM:-linux}-${TAG:-latest} + build: + context: . + dockerfile: src/Services/TenantManager/TenantManager/Dockerfile + depends_on: + - sql.data + catalog.api: image: ${REGISTRY:-eshop}/catalog.api:${PLATFORM:-linux}-${TAG:-latest} build: diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index 882bca09f..0de6d0ed7 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2027 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29306.81 MinimumVisualStudioVersion = 10.0.40219.1 Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" EndProject @@ -148,7 +148,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebhookClient", "src\Web\We EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Devspace.Support", "Devspace.Support", "{68F5041D-51F2-4630-94B6-B49789F5E51A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Devspaces.Support", "src\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj", "{56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Devspaces.Support", "src\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj", "{56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TenantCustomisations", "TenantCustomisations", "{D2D53ADC-5230-4EF4-95B0-31FD734992F6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TenantACustomisations", "..\TenantACustomisations\TenantACustomisations.csproj", "{6CBF0D7F-7566-428E-B704-4059A10FFD52}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TenantManager", "TenantManager", "{71587505-2945-4286-BF0B-BA4C004B0BA7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TenantManager", "src\Services\TenantManager\TenantManager\TenantManager.csproj", "{9C101827-119D-44EE-B0F0-94E7ABA8AE6A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1796,6 +1804,102 @@ Global {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x64.Build.0 = Release|Any CPU {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x86.ActiveCfg = Release|Any CPU {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35}.Release|x86.Build.0 = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|ARM.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|iPhone.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|x64.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|x64.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|x86.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.AppStore|x86.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|ARM.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|iPhone.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|x64.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|x64.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|x86.ActiveCfg = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Debug|x86.Build.0 = Debug|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|Any CPU.Build.0 = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|ARM.ActiveCfg = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|ARM.Build.0 = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|iPhone.ActiveCfg = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|iPhone.Build.0 = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|x64.ActiveCfg = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|x64.Build.0 = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|x86.ActiveCfg = Release|Any CPU + {6CBF0D7F-7566-428E-B704-4059A10FFD52}.Release|x86.Build.0 = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|ARM.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|iPhone.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|x64.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|x64.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|x86.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.AppStore|x86.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|ARM.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|iPhone.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|x64.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|x64.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|x86.ActiveCfg = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Debug|x86.Build.0 = Debug|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|Any CPU.Build.0 = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|ARM.ActiveCfg = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|ARM.Build.0 = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|iPhone.ActiveCfg = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|iPhone.Build.0 = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|x64.ActiveCfg = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|x64.Build.0 = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|x86.ActiveCfg = Release|Any CPU + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1862,6 +1966,10 @@ Global {766D7E92-6AF0-476C-ADD5-282BF4D8C576} = {E279BF0F-7F66-4F3A-A3AB-2CDA66C1CD04} {68F5041D-51F2-4630-94B6-B49789F5E51A} = {DB0EFB20-B024-4E5E-A75C-52143C131D25} {56C2EF0B-6BF2-41D9-BE07-6E6D08D06B35} = {68F5041D-51F2-4630-94B6-B49789F5E51A} + {D2D53ADC-5230-4EF4-95B0-31FD734992F6} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} + {6CBF0D7F-7566-428E-B704-4059A10FFD52} = {D2D53ADC-5230-4EF4-95B0-31FD734992F6} + {71587505-2945-4286-BF0B-BA4C004B0BA7} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} + {9C101827-119D-44EE-B0F0-94E7ABA8AE6A} = {71587505-2945-4286-BF0B-BA4C004B0BA7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} diff --git a/src/Services/TenantManager/TenantManager/Controllers/CustomisationsController.cs b/src/Services/TenantManager/TenantManager/Controllers/CustomisationsController.cs new file mode 100644 index 000000000..12f9367bb --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Controllers/CustomisationsController.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using TenantManager.Database; +using TenantManager.Models; + +namespace TenantManager.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class CustomisationsController : ControllerBase + { + private readonly TenantManagerContext _context; + + public CustomisationsController(TenantManagerContext context) + { + _context = context; + } + + // GET: api/Customisations + [HttpGet] + public async Task>> GetCustomisation() + { + return await _context.Customisation.ToListAsync(); + } + + // GET: api/Customisations/5 + [HttpGet("{id}")] + public async Task> GetCustomisation(int id) + { + var customisation = await _context.Customisation.FindAsync(id); + + if (customisation == null) + { + return NotFound(); + } + + return customisation; + } + + // PUT: api/Customisations/5 + [HttpPut("{id}")] + public async Task PutCustomisation(int id, Customisation customisation) + { + if (id != customisation.CustomisationId) + { + return BadRequest(); + } + + _context.Entry(customisation).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!CustomisationExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return NoContent(); + } + + // POST: api/Customisations + [HttpPost] + public async Task> PostCustomisation(Customisation customisation) + { + _context.Customisation.Add(customisation); + await _context.SaveChangesAsync(); + + return CreatedAtAction("GetCustomisation", new { id = customisation.CustomisationId }, customisation); + } + + // DELETE: api/Customisations/5 + [HttpDelete("{id}")] + public async Task> DeleteCustomisation(int id) + { + var customisation = await _context.Customisation.FindAsync(id); + if (customisation == null) + { + return NotFound(); + } + + _context.Customisation.Remove(customisation); + await _context.SaveChangesAsync(); + + return customisation; + } + + private bool CustomisationExists(int id) + { + return _context.Customisation.Any(e => e.CustomisationId == id); + } + } +} diff --git a/src/Services/TenantManager/TenantManager/Controllers/MethodsController.cs b/src/Services/TenantManager/TenantManager/Controllers/MethodsController.cs new file mode 100644 index 000000000..35e3f9271 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Controllers/MethodsController.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using TenantManager.Database; +using TenantManager.Models; + +namespace TenantManager.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class MethodsController : ControllerBase + { + private readonly TenantManagerContext _context; + + public MethodsController(TenantManagerContext context) + { + _context = context; + } + + // GET: api/Methods + [HttpGet] + public async Task>> GetMethod() + { + return await _context.Method.ToListAsync(); + } + + // GET: api/Methods/5 + [HttpGet("{id}")] + public async Task> GetMethod(int id) + { + var @method = await _context.Method.FindAsync(id); + + if (@method == null) + { + return NotFound(); + } + + return @method; + } + + // PUT: api/Methods/5 + [HttpPut("{id}")] + public async Task PutMethod(int id, Method @method) + { + if (id != @method.MethodId) + { + return BadRequest(); + } + + _context.Entry(@method).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!MethodExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return NoContent(); + } + + // POST: api/Methods + [HttpPost] + public async Task> PostMethod(Method @method) + { + _context.Method.Add(@method); + await _context.SaveChangesAsync(); + + return CreatedAtAction("GetMethod", new { id = @method.MethodId }, @method); + } + + // DELETE: api/Methods/5 + [HttpDelete("{id}")] + public async Task> DeleteMethod(int id) + { + var @method = await _context.Method.FindAsync(id); + if (@method == null) + { + return NotFound(); + } + + _context.Method.Remove(@method); + await _context.SaveChangesAsync(); + + return @method; + } + + private bool MethodExists(int id) + { + return _context.Method.Any(e => e.MethodId == id); + } + } +} diff --git a/src/Services/TenantManager/TenantManager/Controllers/TenantsController.cs b/src/Services/TenantManager/TenantManager/Controllers/TenantsController.cs new file mode 100644 index 000000000..2ce3ca064 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Controllers/TenantsController.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using TenantManager.Models; + +namespace TenantManager.Database +{ + [Route("api/[controller]")] + [ApiController] + public class TenantsController : ControllerBase + { + private readonly TenantManagerContext _context; + + public TenantsController(TenantManagerContext context) + { + _context = context; + } + + // GET: api/Tenants + [HttpGet] + public async Task>> GetTenant() + { + return await _context.Tenant.ToListAsync(); + } + + // GET: api/Tenants/5 + [HttpGet("{id}")] + public async Task> GetTenant(long id) + { + var tenant = await _context.Tenant.FindAsync(id); + + if (tenant == null) + { + return NotFound(); + } + + return tenant; + } + + // PUT: api/Tenants/5 + [HttpPut("{id}")] + public async Task PutTenant(long id, Tenant tenant) + { + if (id != tenant.TenantId) + { + return BadRequest(); + } + + _context.Entry(tenant).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!TenantExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return NoContent(); + } + + // POST: api/Tenants + [HttpPost] + public async Task> PostTenant(Tenant tenant) + { + _context.Tenant.Add(tenant); + await _context.SaveChangesAsync(); + + return CreatedAtAction("GetTenant", new { id = tenant.TenantId }, tenant); + } + + // DELETE: api/Tenants/5 + [HttpDelete("{id}")] + public async Task> DeleteTenant(long id) + { + var tenant = await _context.Tenant.FindAsync(id); + if (tenant == null) + { + return NotFound(); + } + + _context.Tenant.Remove(tenant); + await _context.SaveChangesAsync(); + + return tenant; + } + + private bool TenantExists(long id) + { + return _context.Tenant.Any(e => e.TenantId == id); + } + } +} diff --git a/src/Services/TenantManager/TenantManager/Controllers/ValuesController.cs b/src/Services/TenantManager/TenantManager/Controllers/ValuesController.cs new file mode 100644 index 000000000..087690dab --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Controllers/ValuesController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace TenantManager.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class ValuesController : ControllerBase + { + // GET api/values + [HttpGet] + public ActionResult> Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/values/5 + [HttpGet("{id}")] + public ActionResult Get(int id) + { + return "value"; + } + + // POST api/values + [HttpPost] + public void Post([FromBody] string value) + { + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody] string value) + { + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + } +} diff --git a/src/Services/TenantManager/TenantManager/Data/TenantManagerContext.cs b/src/Services/TenantManager/TenantManager/Data/TenantManagerContext.cs new file mode 100644 index 000000000..cde256501 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Data/TenantManagerContext.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using TenantManager.Models; + +namespace TenantManager.Database +{ + public class TenantManagerContext : DbContext + { + public TenantManagerContext (DbContextOptions options) + : base(options) + { + } + + public DbSet Tenant { get; set; } + + public DbSet Method { get; set; } + + public DbSet Customisation { get; set; } + } + + public class TenantManagerContextDesignFactory : IDesignTimeDbContextFactory + { + public TenantManagerContext CreateDbContext(string[] args) + { + var optionsBuilder = new DbContextOptionsBuilder() + .UseSqlServer("Server=.;Initial Catalog=Microsoft.eShopOnContainers.Services.TenantManagerDb;Integrated Security=true"); + + return new TenantManagerContext(optionsBuilder.Options); + } + } +} diff --git a/src/Services/TenantManager/TenantManager/Database/DbInitializer.cs b/src/Services/TenantManager/TenantManager/Database/DbInitializer.cs new file mode 100644 index 000000000..08c77ff6a --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Database/DbInitializer.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TenantManager.Models; + +namespace TenantManager.Database +{ + public static class DbInitializer + { + public static void Initialize(TenantManagerContext context) + { + context.Database.EnsureCreated(); + + if (context.Tenant.Any()) + { + return; + } + + var tenant1 = new Tenant() { TenantName = "Tekna" }; + var tenant2 = new Tenant() { TenantName = "NITO" }; + var tenant3 = new Tenant() { TenantName = "LO" }; + + var tenants = new Tenant[] + { + tenant1, + tenant2, + tenant3 + }; + + foreach(Tenant t in tenants) + { + context.Tenant.Add(t); + } + + context.SaveChanges(); + + var method1 = new Method() { MethodName = "GetPrice" }; + var method2 = new Method() { MethodName = "GetItem" }; + + var methods = new Method[] + { + method1, + method2 + }; + + foreach(Method m in methods) + { + context.Method.Add(m); + } + + context.SaveChanges(); + + var customisations = new Customisation[] + { + new Customisation(){Tenant=tenant1, Method=method1 }, + new Customisation(){Tenant=tenant1, Method=method2}, + new Customisation(){Tenant=tenant2, Method=method1 } + }; + + foreach(Customisation c in customisations) + { + context.Add(c); + } + + context.SaveChanges(); + + } + } +} diff --git a/src/Services/TenantManager/TenantManager/Dockerfile b/src/Services/TenantManager/TenantManager/Dockerfile new file mode 100644 index 000000000..cdc32eb06 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Dockerfile @@ -0,0 +1,59 @@ +FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build +WORKDIR /src + +# Keep the project list and command dotnet restore identical in all Dockfiles to maximize image cache utilization +COPY eShopOnContainers-ServicesAndWebApps.sln . +COPY docker-compose.dcproj /src/ +COPY src/ApiGateways/ApiGw-Base/OcelotApiGw.csproj src/ApiGateways/ApiGw-Base/ +COPY src/ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.csproj src/ApiGateways/Mobile.Bff.Shopping/aggregator/ +COPY src/ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj src/ApiGateways/Web.Bff.Shopping/aggregator/ +COPY src/BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj src/BuildingBlocks/Devspaces.Support/ +COPY src/BuildingBlocks/EventBus/EventBus/EventBus.csproj src/BuildingBlocks/EventBus/EventBus/ +COPY src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj src/BuildingBlocks/EventBus/EventBus.Tests/ +COPY src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj src/BuildingBlocks/EventBus/EventBusRabbitMQ/ +COPY src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj src/BuildingBlocks/EventBus/EventBusServiceBus/ +COPY src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj src/BuildingBlocks/EventBus/IntegrationEventLogEF/ +COPY src/BuildingBlocks/WebHostCustomization/WebHost.Customization/WebHost.Customization.csproj src/BuildingBlocks/WebHostCustomization/WebHost.Customization/ +COPY src/Services/Basket/Basket.API/Basket.API.csproj src/Services/Basket/Basket.API/ +COPY src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj src/Services/Basket/Basket.FunctionalTests/ +COPY src/Services/Basket/Basket.UnitTests/Basket.UnitTests.csproj src/Services/Basket/Basket.UnitTests/ +COPY src/Services/Catalog/Catalog.API/Catalog.API.csproj src/Services/Catalog/Catalog.API/ +COPY src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj src/Services/Catalog/Catalog.FunctionalTests/ +COPY src/Services/Catalog/Catalog.UnitTests/Catalog.UnitTests.csproj src/Services/Catalog/Catalog.UnitTests/ +COPY src/Services/Identity/Identity.API/Identity.API.csproj src/Services/Identity/Identity.API/ +COPY src/Services/Location/Locations.API/Locations.API.csproj src/Services/Location/Locations.API/ +COPY src/Services/Location/Locations.FunctionalTests/Locations.FunctionalTests.csproj src/Services/Location/Locations.FunctionalTests/ +COPY src/Services/Marketing/Marketing.API/Marketing.API.csproj src/Services/Marketing/Marketing.API/ +COPY src/Services/Marketing/Marketing.FunctionalTests/Marketing.FunctionalTests.csproj src/Services/Marketing/Marketing.FunctionalTests/ +COPY src/Services/Ordering/Ordering.API/Ordering.API.csproj src/Services/Ordering/Ordering.API/ +COPY src/Services/Ordering/Ordering.BackgroundTasks/Ordering.BackgroundTasks.csproj src/Services/Ordering/Ordering.BackgroundTasks/ +COPY src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj src/Services/Ordering/Ordering.Domain/ +COPY src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj src/Services/Ordering/Ordering.FunctionalTests/ +COPY src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj src/Services/Ordering/Ordering.Infrastructure/ +COPY src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj src/Services/Ordering/Ordering.SignalrHub/ +COPY src/Services/Ordering/Ordering.UnitTests/Ordering.UnitTests.csproj src/Services/Ordering/Ordering.UnitTests/ +COPY src/Services/Payment/Payment.API/Payment.API.csproj src/Services/Payment/Payment.API/ +COPY src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj src/Services/Webhooks/Webhooks.API/ +COPY src/Web/WebhookClient/WebhookClient.csproj src/Web/WebhookClient/ +COPY src/Web/WebMVC/WebMVC.csproj src/Web/WebMVC/ +COPY src/Web/WebSPA/WebSPA.csproj src/Web/WebSPA/ +COPY src/Web/WebStatus/WebStatus.csproj src/Web/WebStatus/ +COPY test/ServicesTests/Application.FunctionalTests/Application.FunctionalTests.csproj test/ServicesTests/Application.FunctionalTests/ +COPY test/ServicesTests/LoadTest/LoadTest.csproj test/ServicesTests/LoadTest/ + +RUN dotnet restore eShopOnContainers-ServicesAndWebApps.sln + +COPY . . +WORKDIR /src/src/Services/TenantManager/TenantManager +RUN dotnet publish --no-restore -c Release -o /app + +FROM build AS publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app . +ENTRYPOINT ["dotnet", "TenantManager.dll"] diff --git a/src/Services/TenantManager/TenantManager/Models/Customisation.cs b/src/Services/TenantManager/TenantManager/Models/Customisation.cs new file mode 100644 index 000000000..ad6f3669b --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Models/Customisation.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TenantManager.Models +{ + public class Customisation + { + public int CustomisationId { get; set; } + public int TenantId { get; set; } + public virtual Tenant Tenant { get; set; } + public int MethodId { get; set; } + public virtual Method Method { get; set; } + } +} diff --git a/src/Services/TenantManager/TenantManager/Models/Methods.cs b/src/Services/TenantManager/TenantManager/Models/Methods.cs new file mode 100644 index 000000000..b1ab9027c --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Models/Methods.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace TenantManager.Models +{ + public class Method + { + public int MethodId { get; set; } + public String MethodName { get; set; } + public ICollection Customisations { get; set; } + } +} diff --git a/src/Services/TenantManager/TenantManager/Models/Tenant.cs b/src/Services/TenantManager/TenantManager/Models/Tenant.cs new file mode 100644 index 000000000..72cb69624 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Models/Tenant.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace TenantManager.Models +{ + public class Tenant + { + public String TenantName { get; set; } + [Key] + public long TenantId { get; set; } + public ICollection Customisations { get; set; } + } +} diff --git a/src/Services/TenantManager/TenantManager/Program.cs b/src/Services/TenantManager/TenantManager/Program.cs new file mode 100644 index 000000000..ffa8db319 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Program.cs @@ -0,0 +1,44 @@ + using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using TenantManager.Database; + +namespace TenantManager +{ + public class Program + { + public static void Main(string[] args) + { + var host = CreateWebHostBuilder(args).Build(); + + using (var scope = host.Services.CreateScope()) + { + var services = scope.ServiceProvider; + + try + { + var context = services.GetRequiredService(); + DbInitializer.Initialize(context); + } + catch (Exception ex) + { + var logger = services.GetRequiredService>(); + logger.LogError(ex, "An error occurred creating the DB."); + } + } + + host.Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/src/Services/TenantManager/TenantManager/Properties/launchSettings.json b/src/Services/TenantManager/TenantManager/Properties/launchSettings.json new file mode 100644 index 000000000..56d433179 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Properties/launchSettings.json @@ -0,0 +1,42 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:62897", + "sslPort": 44318 + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "TenantManager": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values", + "environmentVariables": { + "ASPNETCORE_URLS": "https://+:443;http://+:80", + "ASPNETCORE_HTTPS_PORT": "44319" + }, + "httpPort": 62898, + "useSSL": true, + "sslPort": 44319 + } + } +} \ No newline at end of file diff --git a/src/Services/TenantManager/TenantManager/Startup.cs b/src/Services/TenantManager/TenantManager/Startup.cs new file mode 100644 index 000000000..b792ced85 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/Startup.cs @@ -0,0 +1,134 @@ +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.Logging; +using Microsoft.Extensions.Options; +using Microsoft.EntityFrameworkCore; +using TenantManager.Database; +using Microsoft.EntityFrameworkCore.Diagnostics; +using System.Reflection; +using Autofac; +using Autofac.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Http; + +namespace TenantManager +{ + public static class CustomExtensionMethods + { + public static IServiceCollection AddCustomDbContext(this IServiceCollection services, IConfiguration configuration) + { + services.AddDbContext(options => + options.UseSqlServer(configuration["ConnectionString"])); + //services.AddDbContext(options => + //{ + // options.UseSqlServer(configuration["ConnectionString"], + // sqlServerOptionsAction: sqlOptions => + // { + // sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name); + // //Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency + // sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null); + // }); + + // // Changing default behavior when client evaluation occurs to throw. + // // Default in EF Core would be to log a warning when client evaluation is performed. + // options.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)); + // //Check Client vs. Server evaluation: https://docs.microsoft.com/en-us/ef/core/querying/client-eval + //}); + + return services; + } + + + public static IServiceCollection AddCustomMvc(this IServiceCollection services) + { + // Add framework services. + services.AddMvc() + .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) + .AddControllersAsServices(); //Injecting Controllers themselves thru DI + //For further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services + + services.AddCors(options => + { + options.AddPolicy("CorsPolicy", + builder => builder + .SetIsOriginAllowed((host) => true) + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials()); + }); + + return services; + } + + public static IServiceCollection AddCustomConfiguration(this IServiceCollection services, IConfiguration configuration) + { + services.AddOptions(); + services.Configure(configuration); + services.Configure(options => + { + options.InvalidModelStateResponseFactory = context => + { + var problemDetails = new ValidationProblemDetails(context.ModelState) + { + Instance = context.HttpContext.Request.Path, + Status = StatusCodes.Status400BadRequest, + Detail = "Please refer to the errors property for additional details." + }; + + return new BadRequestObjectResult(problemDetails) + { + ContentTypes = { "application/problem+json", "application/problem+xml" } + }; + }; + }); + + return services; + } + } + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public IServiceProvider ConfigureServices(IServiceCollection services) + { + services + .AddCustomDbContext(Configuration) + .AddCustomMvc() + .AddCustomConfiguration(Configuration); + + var container = new ContainerBuilder(); + container.Populate(services); + return new AutofacServiceProvider(container.Build()); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseMvc(); + } + } +} \ No newline at end of file diff --git a/src/Services/TenantManager/TenantManager/TenantManager.csproj b/src/Services/TenantManager/TenantManager/TenantManager.csproj new file mode 100644 index 000000000..6b071fc3c --- /dev/null +++ b/src/Services/TenantManager/TenantManager/TenantManager.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp2.2 + InProcess + 32cd2988-8f43-4aff-88af-6a3397a7d2e6 + Linux + ..\..\..\..\docker-compose.dcproj + + + + + + + + + + + + + + + + + diff --git a/src/Services/TenantManager/TenantManager/TenantManagerSettings.cs b/src/Services/TenantManager/TenantManager/TenantManagerSettings.cs new file mode 100644 index 000000000..f4ab4aab9 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/TenantManagerSettings.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace TenantManager +{ + public class TenantManagerSettings + { + public string ConnectionString { get; set; } + + } +} diff --git a/src/Services/TenantManager/TenantManager/appsettings.Development.json b/src/Services/TenantManager/TenantManager/appsettings.Development.json new file mode 100644 index 000000000..e203e9407 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/Services/TenantManager/TenantManager/appsettings.json b/src/Services/TenantManager/TenantManager/appsettings.json new file mode 100644 index 000000000..69d1ee9e5 --- /dev/null +++ b/src/Services/TenantManager/TenantManager/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.TenantManagerDb;User Id=sa;Password=Pass@word;" +} \ No newline at end of file