From 4d56898bce01a73599721bbc99af13b055ae9da9 Mon Sep 17 00:00:00 2001 From: CodeLiturgy Date: Fri, 19 Aug 2022 04:18:50 +0100 Subject: [PATCH] Users and Finance Ops work wip --- BlueWest.Api/Controllers/CountryController.cs | 226 ++++++++++-------- BlueWest.Api/Controllers/UserController.cs | 41 +++- BlueWest.Api/Dockerfile | 2 +- BlueWest.Api/MySQL/CountriesDbContext.cs | 22 +- BlueWest.Api/MySQL/FinanceDbContext.cs | 14 +- BlueWest.Api/MySQL/ModelBuilderExtensions.cs | 62 +++++ BlueWest.Api/MySQL/UserDbContext.cs | 19 +- BlueWest.Api/Startup.cs | 19 +- BlueWest.Api/StartupExtensions.cs | 8 +- BlueWest.Data/Country/Country.cs | 13 +- BlueWest.Data/Country/CountryCreate.cs | 4 +- BlueWest.Data/Currency/CurrencyCreate.cs | 2 +- BlueWest.Data/Transaction/FinanceOp.cs | 4 +- BlueWest.Data/Transaction/FinanceOpCreate.cs | 4 +- BlueWest.Data/Transaction/FinanceOpRead.cs | 2 +- BlueWest.Data/Transaction/FinanceOpType.cs | 21 +- BlueWest.Data/User/User.cs | 12 +- .../User/{UserUpdateDto.cs => UserCreate.cs} | 8 +- BlueWest.sln | 8 +- README.md | 2 +- docker-compose.yml | 3 - 21 files changed, 302 insertions(+), 194 deletions(-) create mode 100644 BlueWest.Api/MySQL/ModelBuilderExtensions.cs rename BlueWest.Data/User/{UserUpdateDto.cs => UserCreate.cs} (53%) diff --git a/BlueWest.Api/Controllers/CountryController.cs b/BlueWest.Api/Controllers/CountryController.cs index cd6437b..d096a8b 100644 --- a/BlueWest.Api/Controllers/CountryController.cs +++ b/BlueWest.Api/Controllers/CountryController.cs @@ -7,119 +7,139 @@ using Microsoft.AspNetCore.Mvc; namespace BlueWest.WebApi.Controllers { -/// -/// Controller responsible to get country data -/// -[ApiController] -[Route("[controller]")] -public class CountryController : ControllerBase -{ - private readonly CountriesDbContext _dbContext; - /// - /// Controller responsible for handling country data in the Country table + /// Controller responsible to get country data /// - /// - public CountryController(CountriesDbContext dbContext) + [ApiController] + [Route("[controller]")] + public class CountryController : ControllerBase { - _dbContext = dbContext; - } + private readonly CountriesDbContext _dbContext; - - /// - /// Add Country - /// - /// The country data to create - /// The newly created country - /// /// - /// Creates a Country. - /// - /// - /// Sample request: - /// - /// POST /Countries - /// { - /// "code": 1, - /// "stateName": "United States of America", - /// "tld": "us" - /// } - /// - /// - /// Returns the newly created country - [ProducesResponseType(StatusCodes.Status201Created)] - [HttpPost] - public ActionResult AddCountry(CountryCreate countryToCreate) - { - var newCountry = countryToCreate.ToCountry(); - _dbContext.Countries.Add(newCountry); - _dbContext.SaveChanges(); - return CreatedAtRoute(nameof(GetCountryById), new {countryId = newCountry.Code}, newCountry); - } - - /// - /// Updates a Country - /// - /// The country ISO 3166 code - /// Country payload data - /// - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [HttpPut("{countryCode}")] - public ActionResult UpdateCountry(int countryCode, CountryUpdate countryToUpdate) - { - - var country = _dbContext.Countries.FirstOrDefault(x => x.Code == countryCode); - - if (country != null) + /// + /// Controller responsible for handling country data in the Country table + /// + /// + public CountryController(CountriesDbContext dbContext) { - var updatedCountry = new Country(countryToUpdate, countryCode, null); - _dbContext.Countries.Update(updatedCountry); - return Ok(updatedCountry); + _dbContext = dbContext; } - - return new NotFoundResult(); - } - - /// - /// Get countries - /// - /// - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - [HttpGet] - public ActionResult GetCountries() - { - var array = _dbContext.Countries; - - if (array != null) + + /// + /// Add Country + /// + /// The country data to create + /// The newly created country + /// /// + /// Creates a Country. + /// + /// + /// Sample request: + /// + /// POST /Countries + /// { + /// "code": 1, + /// "stateName": "United States of America", + /// "tld": "us" + /// } + /// + /// + /// Returns the newly created country + [ProducesResponseType(StatusCodes.Status201Created)] + [HttpPost] + public ActionResult AddCountry(CountryCreate countryToCreate) { - return Ok(array.ToArray()); + var newCountry = countryToCreate.ToCountry(); + _dbContext.Countries.Add(newCountry); + _dbContext.SaveChanges(); + return CreatedAtRoute(nameof(GetCountryById), new {countryId = newCountry.Code}, newCountry); } - - return new NotFoundResult(); - } - - /// - /// Get Country by Id - /// - /// ISO 3166-1 country numeric code - /// - [ProducesResponseType(StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status404NotFound)] - [HttpGet("{countryId}", Name = nameof(GetCountryById))] - public ActionResult GetCountryById(int countryId) - { - var array = _dbContext.Countries.FirstOrDefault(x => x.Code == countryId); - - if (array != null) + + /// + /// Updates a Country + /// + /// The country ISO 3166 code + /// Country payload data + /// + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [HttpPut("{countryCode}")] + public ActionResult UpdateCountry(int countryCode, CountryUpdate countryToUpdate) { + var country = _dbContext.Countries.FirstOrDefault(x => x.Code == countryCode); + + if (country != null) + { + var updatedCountry = new Country(countryToUpdate, countryCode, null, null); + _dbContext.Countries.Update(updatedCountry); + return Ok(updatedCountry); + } + + return new NotFoundResult(); + } + + + /// + /// Get countries + /// + /// + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [HttpGet] + public ActionResult GetCountries() + { + var array = _dbContext.Countries; + + if (array != null) + { + return Ok(array.ToArray()); + } + + return new NotFoundResult(); + } + + /// + /// Get Country by Id + /// + /// ISO 3166-1 country numeric code + /// + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [HttpGet("{countryId}", Name = nameof(GetCountryById))] + public ActionResult GetCountryById(int countryId) + { + var array = _dbContext.Countries.FirstOrDefault(x => x.Code == countryId); + + if (array != null) + { + return Ok(array); + } + + return new NotFoundResult(); + } + + /// + /// Get currencies of a country + /// + /// + /// + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [HttpGet("{countryId}/currencies")] + public ActionResult GetCountryCurrencies(int countryId) + { + var country = _dbContext.Countries.FirstOrDefault(d => d.Code == countryId); + + if (country == null) return new NotFoundResult(); + + var array = _dbContext + .Countries + .Where(data => data.Code == countryId) + .SelectMany(o => o.Currencies) + .ToArray(); + return Ok(array); } - - return new NotFoundResult(); } - - -} -} +} \ No newline at end of file diff --git a/BlueWest.Api/Controllers/UserController.cs b/BlueWest.Api/Controllers/UserController.cs index 8fd01af..2b380c3 100644 --- a/BlueWest.Api/Controllers/UserController.cs +++ b/BlueWest.Api/Controllers/UserController.cs @@ -16,18 +16,25 @@ namespace BlueWest.WebApi.Controllers private readonly UserDbContext _dbContext; + /// + /// Controller responsible to handle user data + /// + /// public UserController(UserDbContext dbContext) { _dbContext = dbContext; } + /// + /// Gets all the users in the user table12312 + /// + /// [ProducesResponseType(StatusCodes.Status200OK)] [HttpGet] public ActionResult Get() { - var users = _dbContext.Users.ToImmutableArray(); - + var users = _dbContext.Users.ToArray(); return Ok(users); } @@ -41,7 +48,7 @@ namespace BlueWest.WebApi.Controllers [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] [HttpGet("{userId}", Name = nameof(GetUserById))] - public ActionResult GetUserById(TimeSpan userId) + public ActionResult GetUserById(int userId) { var user = _dbContext.Users.FirstOrDefault(x => x.Id == userId); @@ -54,29 +61,45 @@ namespace BlueWest.WebApi.Controllers } + /// + /// Adds a user to the database + /// + /// User to add + /// [ProducesResponseType(StatusCodes.Status201Created)] [HttpPost] - public ActionResult AddUser(UserUpdateDto userUpdateDto) + public ActionResult AddUser(UserCreate userCreate) { - var user = new User(userUpdateDto, DateTime.Now.TimeOfDay, new List()); + var user = new User(userCreate, 0, new List(), null); _dbContext.Users.Add(user); _dbContext.SaveChanges(); return CreatedAtRoute(nameof(GetUserById), new {userId = user.Id}, user); } + /// + /// Updates user data + /// + /// User id + /// + /// [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - [HttpPut("{userId}")] - public ActionResult UpdateUser(int userId, UserUpdateDto userUpdate) + [HttpPut($"{{userId:int}}")] + public ActionResult UpdateUser(int userId, UserCreate userCreate) { return new NotFoundResult(); } + /// + /// Deletes a user from the database + /// + /// + /// [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - [HttpDelete("{id}")] - public ActionResult DeleteUser(TimeSpan id) + [HttpDelete("{id:int}")] + public ActionResult DeleteUser(int id) { var user = _dbContext.Users.FirstOrDefault(u => u.Id == id); if (user == null) diff --git a/BlueWest.Api/Dockerfile b/BlueWest.Api/Dockerfile index e4e1a81..faff182 100644 --- a/BlueWest.Api/Dockerfile +++ b/BlueWest.Api/Dockerfile @@ -8,9 +8,9 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["BlueWest.Api/BlueWest.Api.csproj", "BlueWest.Api/"] +RUN dotnet restore "BlueWest.Api/BlueWest.Api.csproj" COPY [".", "."] -RUN dotnet restore "BlueWest.Api/BlueWest.Api.csproj" RUN dotnet build "BlueWest.Api/BlueWest.Api.csproj" -c Release -o /app/build FROM build AS publish diff --git a/BlueWest.Api/MySQL/CountriesDbContext.cs b/BlueWest.Api/MySQL/CountriesDbContext.cs index 13d61b7..97c0a7d 100644 --- a/BlueWest.Api/MySQL/CountriesDbContext.cs +++ b/BlueWest.Api/MySQL/CountriesDbContext.cs @@ -13,8 +13,9 @@ public class CountriesDbContext : DbContext public DbSet Countries { get; set; } public DbSet Currencies { get; set; } + public DbSet Users { get; set; } + - public IConfiguration Configuration; @@ -44,23 +45,6 @@ public class CountriesDbContext : DbContext protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); - modelBuilder.Entity(builder => - { - builder.HasKey(x => x.Code); - }); - modelBuilder.Entity(builder => - { - builder.HasKey(x => x.Num); - }); - - modelBuilder.Entity() - .HasMany(ub => ub.Countries) - .WithMany(au => au.Currencies); - - modelBuilder.Entity() - .HasMany(ub => ub.Currencies) - .WithMany(au => au.Countries); - - + modelBuilder.ProjectDatabaseModel(); } } \ No newline at end of file diff --git a/BlueWest.Api/MySQL/FinanceDbContext.cs b/BlueWest.Api/MySQL/FinanceDbContext.cs index 324b3b9..6cbec24 100644 --- a/BlueWest.Api/MySQL/FinanceDbContext.cs +++ b/BlueWest.Api/MySQL/FinanceDbContext.cs @@ -10,11 +10,21 @@ namespace BlueWest.WebApi.MySQL { public DbSet Transactions { get; set; } public DbSet TransactionTypes { get; set; } - - public FinanceDbContext(DbContextOptions options) : base(options) + + /// + /// Finance transactions context + /// + /// + public FinanceDbContext(DbContextOptions options) : base(options) { Database.EnsureCreated(); } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.ProjectDatabaseModel(); + } } } diff --git a/BlueWest.Api/MySQL/ModelBuilderExtensions.cs b/BlueWest.Api/MySQL/ModelBuilderExtensions.cs new file mode 100644 index 0000000..9e77f5b --- /dev/null +++ b/BlueWest.Api/MySQL/ModelBuilderExtensions.cs @@ -0,0 +1,62 @@ +using BlueWest.Data; +using Microsoft.EntityFrameworkCore; + +namespace BlueWest.WebApi.MySQL +{ + public static class ModelBuilderExtensions + { + public static void ProjectDatabaseModel(this ModelBuilder modelBuilder) + { + // Keys + CountryCurrencyModel(modelBuilder); + UserModel(modelBuilder); + + } + + private static void CountryCurrencyModel(ModelBuilder modelBuilder) + { + modelBuilder.Entity(builder => + { + builder.HasKey(x => x.Code); + }); + modelBuilder.Entity(builder => + { + builder.HasKey(x => x.Num); + }); + + // Relationships + modelBuilder.Entity() + .HasMany(ub => ub.Countries) + .WithMany(au => au.Currencies); + + modelBuilder.Entity() + .HasMany(ub => ub.Currencies) + .WithMany(au => au.Countries); + + } + + private static void UserModel(ModelBuilder modelBuilder) + { + + modelBuilder.Entity(builder => + builder + .HasMany() + .WithOne(user => user.Country)); + + modelBuilder + .Entity(builder => builder + .HasOne() + .WithMany(co => co.Users)); + + + + modelBuilder.Entity(builder => + { + builder.HasOne() + .WithMany(x => x.FinanceTransactions) + .HasForeignKey(x => x.UserId); + }); + } + } +} + diff --git a/BlueWest.Api/MySQL/UserDbContext.cs b/BlueWest.Api/MySQL/UserDbContext.cs index 4cc79c9..f8be873 100644 --- a/BlueWest.Api/MySQL/UserDbContext.cs +++ b/BlueWest.Api/MySQL/UserDbContext.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Configuration; namespace BlueWest.WebApi.MySQL { - public sealed class UserDbContext : DbContext + public class UserDbContext : DbContext { public DbSet Users { get; set; } @@ -21,7 +21,6 @@ namespace BlueWest.WebApi.MySQL public UserDbContext(DbContextOptions options) : base(options) { Database.EnsureCreated(); - } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) @@ -35,21 +34,7 @@ namespace BlueWest.WebApi.MySQL protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); - - modelBuilder.Entity(builder => - { - builder.HasKey(x => x.Id); - }); - - modelBuilder.Entity(builder => - { - builder.HasOne() - .WithMany(x => x.FinanceTransactions) - .HasForeignKey(x => x.UserId); - }); - - - + modelBuilder.ProjectDatabaseModel(); } } } diff --git a/BlueWest.Api/Startup.cs b/BlueWest.Api/Startup.cs index e56f78e..f47dbb8 100644 --- a/BlueWest.Api/Startup.cs +++ b/BlueWest.Api/Startup.cs @@ -85,18 +85,13 @@ namespace BlueWest.WebApi var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); options.IncludeXmlComments(xmlPath); }); - - - services.AddDbContextPool(options => - options.GetSqlSettings(Configuration)) - .AddDbContextPool(options => - options.GetSqlSettings(Configuration)) - .AddDbContextPool(options => - options.GetSqlSettings(Configuration)) - .AddDbContextPool(options => - options.GetSqlSettings(Configuration)); - - + + + services + .AddDbContextPool(options => options.GetSqlSettings(Configuration)) + .AddDbContextPool(options => options.GetSqlSettings(Configuration)) + .AddDbContextPool(options => options.GetSqlSettings(Configuration)) + ; // services.AddGrpc(); } diff --git a/BlueWest.Api/StartupExtensions.cs b/BlueWest.Api/StartupExtensions.cs index eb75c8f..947141f 100644 --- a/BlueWest.Api/StartupExtensions.cs +++ b/BlueWest.Api/StartupExtensions.cs @@ -1,6 +1,7 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; namespace BlueWest.WebApi; @@ -9,6 +10,11 @@ public static class StartupExtensions public static void GetSqlSettings(this DbContextOptionsBuilder optionsBuilder, IConfiguration configuration) { optionsBuilder.UseMySql(configuration.GetConnectionString("LocalMySQL"), - new MySqlServerVersion(new Version(8, 0, 11))); + new MySqlServerVersion(new Version(8, 0, 11))) + // The following three options help with debugging, but should + // be changed or removed for production. + .LogTo(Console.WriteLine, LogLevel.Information) + .EnableSensitiveDataLogging() + .EnableDetailedErrors(); } } \ No newline at end of file diff --git a/BlueWest.Data/Country/Country.cs b/BlueWest.Data/Country/Country.cs index 0e16ab1..c3d36a7 100644 --- a/BlueWest.Data/Country/Country.cs +++ b/BlueWest.Data/Country/Country.cs @@ -14,14 +14,23 @@ namespace BlueWest.Data public partial class Country { - // ISO 3166-1 numeric code - public int Code { get; set; } // Primary key + /// + /// ISO 3166-1 numeric code + /// Primary key. + /// + public int Code { get; set; } + + /// + /// ISO 3166-1 State Name + /// public string StateName { get; set; } [MaxLength(2)] public string Alpha2Code { get; set; } public string TLD { get; set; } public List Currencies { get; set; } + public List Users { get; set; } + [JsonConstructor] public Country(int code, string stateName, string tld, List currencies) diff --git a/BlueWest.Data/Country/CountryCreate.cs b/BlueWest.Data/Country/CountryCreate.cs index b8c596d..ab1370e 100644 --- a/BlueWest.Data/Country/CountryCreate.cs +++ b/BlueWest.Data/Country/CountryCreate.cs @@ -27,8 +27,8 @@ namespace BlueWest.Data { currencies.Add(new Currency(currencyCreate, null)); } - - return new Country(this, currencies); + + return new Country(this, currencies, null); } } diff --git a/BlueWest.Data/Currency/CurrencyCreate.cs b/BlueWest.Data/Currency/CurrencyCreate.cs index f6038a3..9e47eaf 100644 --- a/BlueWest.Data/Currency/CurrencyCreate.cs +++ b/BlueWest.Data/Currency/CurrencyCreate.cs @@ -18,7 +18,7 @@ namespace BlueWest.Data foreach (var countryCreate in CountriesToCreate) { - var newCountry = new Country(countryCreate, null); + var newCountry = new Country(countryCreate, null, null); countries.Add(newCountry); } diff --git a/BlueWest.Data/Transaction/FinanceOp.cs b/BlueWest.Data/Transaction/FinanceOp.cs index c0c7a50..4b1f182 100644 --- a/BlueWest.Data/Transaction/FinanceOp.cs +++ b/BlueWest.Data/Transaction/FinanceOp.cs @@ -8,7 +8,7 @@ namespace BlueWest.Data public partial class FinanceOp { - public TimeSpan UserId { get; set; } + public int UserId { get; set; } [Key] public TimeSpan CreationDate { get; set; } @@ -21,7 +21,7 @@ namespace BlueWest.Data public FinanceOp() { } - public FinanceOp(TimeSpan creationDate, TimeSpan userId, + public FinanceOp(TimeSpan creationDate, int userId, Currency currency, FinanceOpType financeOpType) { CreationDate = creationDate; diff --git a/BlueWest.Data/Transaction/FinanceOpCreate.cs b/BlueWest.Data/Transaction/FinanceOpCreate.cs index cb2c6a7..01351ee 100644 --- a/BlueWest.Data/Transaction/FinanceOpCreate.cs +++ b/BlueWest.Data/Transaction/FinanceOpCreate.cs @@ -9,7 +9,7 @@ namespace BlueWest.Data public partial class FinanceOpCreate { - public TimeSpan UserId { get; set; } + public int UserId { get; set; } public Currency Currency { get; } @@ -17,7 +17,7 @@ namespace BlueWest.Data public FinanceOpCreate( - TimeSpan userId, + int userId, Currency currency , FinanceOpType financeOpType ) diff --git a/BlueWest.Data/Transaction/FinanceOpRead.cs b/BlueWest.Data/Transaction/FinanceOpRead.cs index a96af67..1929082 100644 --- a/BlueWest.Data/Transaction/FinanceOpRead.cs +++ b/BlueWest.Data/Transaction/FinanceOpRead.cs @@ -9,7 +9,7 @@ namespace BlueWest.Data public partial class FinanceTransactionReadDto { - public TimeSpan UserId { get; set; } + public int UserId { get; set; } public Currency Currency { get; } diff --git a/BlueWest.Data/Transaction/FinanceOpType.cs b/BlueWest.Data/Transaction/FinanceOpType.cs index 78dc6bf..ce868ad 100644 --- a/BlueWest.Data/Transaction/FinanceOpType.cs +++ b/BlueWest.Data/Transaction/FinanceOpType.cs @@ -1,12 +1,19 @@ using System.ComponentModel.DataAnnotations; -namespace BlueWest.Data; - -public class FinanceOpType +namespace BlueWest.Data { - [Key] public int Id { get; set; } + public partial class FinanceOpType + { + [Key] public int Id { get; set; } - public string Name; + public string Name; + + private string Description; + + public FinanceOpType() + { + + } + } +} - private string Description; -} \ No newline at end of file diff --git a/BlueWest.Data/User/User.cs b/BlueWest.Data/User/User.cs index 6905dce..8decbdd 100644 --- a/BlueWest.Data/User/User.cs +++ b/BlueWest.Data/User/User.cs @@ -1,22 +1,24 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using MapTo; namespace BlueWest.Data { - [MapFrom( typeof(UserUpdateDto))] + [MapFrom( typeof(UserCreate))] /* [UseUpdate] */ public partial class User { - public TimeSpan Id { get; } = TimeSpan.Zero; + public int Id { get; set; } public string Name { get; set; } - public List FinanceTransactions { get; } + public List FinanceTransactions { get; set; } + public Country Country { get; set; } - - public User(TimeSpan id, string name) + public User(int id, string name) { Id = id; Name = name; diff --git a/BlueWest.Data/User/UserUpdateDto.cs b/BlueWest.Data/User/UserCreate.cs similarity index 53% rename from BlueWest.Data/User/UserUpdateDto.cs rename to BlueWest.Data/User/UserCreate.cs index 4949ee7..4522aed 100644 --- a/BlueWest.Data/User/UserUpdateDto.cs +++ b/BlueWest.Data/User/UserCreate.cs @@ -4,8 +4,14 @@ namespace BlueWest.Data { [MapFrom(typeof(User))] - public partial class UserUpdateDto + public partial class UserCreate { public string Name { get; set; } + + public UserCreate() + { + + } + } } \ No newline at end of file diff --git a/BlueWest.sln b/BlueWest.sln index 201f1a9..5b7e3ec 100644 --- a/BlueWest.sln +++ b/BlueWest.sln @@ -15,8 +15,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleExpressionEvaluator", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "include", "include", "{A1606EEC-6AC5-4779-B140-F57089F5A05F}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data", "data", "{19577B27-7EDF-4DBA-83D5-E047467BDFEF}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleExpressionEvaluator.Tests", "include\Math-Expression-Evaluator\SimpleExpressionEvaluator.Tests\SimpleExpressionEvaluator.Tests.csproj", "{08F4484E-5FD8-4590-A8D7-12FBE47120C8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlueWest.MapTo.Tests", "include\BlueWest.MapTo\test\BlueWest.MapTo.Tests\BlueWest.MapTo.Tests.csproj", "{5BE0A68C-B3ED-4FA1-B74B-3E857504899B}" @@ -27,6 +25,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{D7BF4A BlueWest.Api\Dockerfile = BlueWest.Api\Dockerfile EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "README", "README", "{E9E3CEB0-D00C-46E3-B497-B4ED7B291190}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,7 +74,6 @@ Global GlobalSection(NestedProjects) = preSolution {30637214-EDE9-4C2E-BFD6-E4B163FA308B} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} {72B37540-A12F-466E-A58F-7BA2B247CB74} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} - {E518C62D-768C-4885-9C9D-FD5761605B54} = {19577B27-7EDF-4DBA-83D5-E047467BDFEF} {08F4484E-5FD8-4590-A8D7-12FBE47120C8} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} {5BE0A68C-B3ED-4FA1-B74B-3E857504899B} = {A1606EEC-6AC5-4779-B140-F57089F5A05F} EndGlobalSection diff --git a/README.md b/README.md index 7e0b3f0..cda3857 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ Copy the generated hash, and run: Run the following command to instance a MySQL database and the API: -`docker-compose up --build --force-recreate` \ No newline at end of file +`docker-compose up --build -d` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 4e72aa5..2520efc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,9 +14,7 @@ services: container_name: BW1_API db: container_name: BW1_DB_MYSQL - image: mysql/mysql-server:8.0 - tty: true environment: MYSQL_ROOT_HOST: db MYSQL_USER_HOST: db @@ -28,7 +26,6 @@ services: - ./docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/ phpmyadmin: container_name: BW_PHPMYADMIN - tty: true image: phpmyadmin/phpmyadmin ports: - 80:80