From 9e61c5095899ebf0d9af57ec580f9df69d9392df Mon Sep 17 00:00:00 2001 From: CodeLiturgy Date: Thu, 4 Aug 2022 00:35:01 +0100 Subject: [PATCH] Remove Newtonsoft and add MySQL EF package --- .../BlueWest.Api.csproj | 3 ++- .../Controllers/UserController.cs | 1 - {BlueWest.WebApi => BlueWest.Api}/Program.cs | 0 .../Properties/launchSettings.json | 0 {BlueWest.WebApi => BlueWest.Api}/Protos/greet.proto | 0 .../Service/CommandService.cs | 0 .../Service/GreeterService.cs | 0 {BlueWest.WebApi => BlueWest.Api}/Startup.cs | 6 +++--- .../Tools/SwaggerEnumSchemaFilter.cs | 0 {BlueWest.WebApi => BlueWest.Api}/WeatherForecast.cs | 0 .../appsettings.Development.json | 0 {BlueWest.WebApi => BlueWest.Api}/appsettings.json | 0 BlueWest.Data/User/User.cs | 2 +- BlueWest.sln | 2 +- BlueWest/Data/MemoryData.cs | 6 ++---- BlueWest/Program.cs | 10 ---------- 16 files changed, 9 insertions(+), 21 deletions(-) rename BlueWest.WebApi/BlueWest.WebApi.csproj => BlueWest.Api/BlueWest.Api.csproj (84%) rename {BlueWest.WebApi => BlueWest.Api}/Controllers/UserController.cs (99%) rename {BlueWest.WebApi => BlueWest.Api}/Program.cs (100%) rename {BlueWest.WebApi => BlueWest.Api}/Properties/launchSettings.json (100%) rename {BlueWest.WebApi => BlueWest.Api}/Protos/greet.proto (100%) rename {BlueWest.WebApi => BlueWest.Api}/Service/CommandService.cs (100%) rename {BlueWest.WebApi => BlueWest.Api}/Service/GreeterService.cs (100%) rename {BlueWest.WebApi => BlueWest.Api}/Startup.cs (95%) rename {BlueWest.WebApi => BlueWest.Api}/Tools/SwaggerEnumSchemaFilter.cs (100%) rename {BlueWest.WebApi => BlueWest.Api}/WeatherForecast.cs (100%) rename {BlueWest.WebApi => BlueWest.Api}/appsettings.Development.json (100%) rename {BlueWest.WebApi => BlueWest.Api}/appsettings.json (100%) delete mode 100644 BlueWest/Program.cs diff --git a/BlueWest.WebApi/BlueWest.WebApi.csproj b/BlueWest.Api/BlueWest.Api.csproj similarity index 84% rename from BlueWest.WebApi/BlueWest.WebApi.csproj rename to BlueWest.Api/BlueWest.Api.csproj index efd5660..c757849 100644 --- a/BlueWest.WebApi/BlueWest.WebApi.csproj +++ b/BlueWest.Api/BlueWest.Api.csproj @@ -3,13 +3,14 @@ net6.0 10 + BlueWest.WebApi - + diff --git a/BlueWest.WebApi/Controllers/UserController.cs b/BlueWest.Api/Controllers/UserController.cs similarity index 99% rename from BlueWest.WebApi/Controllers/UserController.cs rename to BlueWest.Api/Controllers/UserController.cs index 693f89d..a980d57 100644 --- a/BlueWest.WebApi/Controllers/UserController.cs +++ b/BlueWest.Api/Controllers/UserController.cs @@ -21,7 +21,6 @@ namespace BlueWest.WebApi.Controllers if (_userList != null) { return Ok(_userList.Users.Values.ToImmutableArray()); - } return new NotFoundResult(); diff --git a/BlueWest.WebApi/Program.cs b/BlueWest.Api/Program.cs similarity index 100% rename from BlueWest.WebApi/Program.cs rename to BlueWest.Api/Program.cs diff --git a/BlueWest.WebApi/Properties/launchSettings.json b/BlueWest.Api/Properties/launchSettings.json similarity index 100% rename from BlueWest.WebApi/Properties/launchSettings.json rename to BlueWest.Api/Properties/launchSettings.json diff --git a/BlueWest.WebApi/Protos/greet.proto b/BlueWest.Api/Protos/greet.proto similarity index 100% rename from BlueWest.WebApi/Protos/greet.proto rename to BlueWest.Api/Protos/greet.proto diff --git a/BlueWest.WebApi/Service/CommandService.cs b/BlueWest.Api/Service/CommandService.cs similarity index 100% rename from BlueWest.WebApi/Service/CommandService.cs rename to BlueWest.Api/Service/CommandService.cs diff --git a/BlueWest.WebApi/Service/GreeterService.cs b/BlueWest.Api/Service/GreeterService.cs similarity index 100% rename from BlueWest.WebApi/Service/GreeterService.cs rename to BlueWest.Api/Service/GreeterService.cs diff --git a/BlueWest.WebApi/Startup.cs b/BlueWest.Api/Startup.cs similarity index 95% rename from BlueWest.WebApi/Startup.cs rename to BlueWest.Api/Startup.cs index 200481b..099f167 100644 --- a/BlueWest.WebApi/Startup.cs +++ b/BlueWest.Api/Startup.cs @@ -41,7 +41,7 @@ namespace BlueWest.WebApi }); }); - services.AddControllers().AddNewtonsoftJson(); + services.AddControllers(); /*services .AddNewtonsoftJson(options => options.SerializerSettings.Converters.Add(new StringEnumConverter())); @@ -53,7 +53,7 @@ namespace BlueWest.WebApi options.SchemaFilter(); options.SwaggerDoc("v1", new OpenApiInfo { - Title = "BlueWest.WebApi", + Title = "BlueWest.Api", Version = "v1" }); }); @@ -68,7 +68,7 @@ namespace BlueWest.WebApi { app.UseDeveloperExceptionPage(); app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BlueWest.WebApi v1")); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BlueWest.Api v1")); } app.UseHttpsRedirection(); diff --git a/BlueWest.WebApi/Tools/SwaggerEnumSchemaFilter.cs b/BlueWest.Api/Tools/SwaggerEnumSchemaFilter.cs similarity index 100% rename from BlueWest.WebApi/Tools/SwaggerEnumSchemaFilter.cs rename to BlueWest.Api/Tools/SwaggerEnumSchemaFilter.cs diff --git a/BlueWest.WebApi/WeatherForecast.cs b/BlueWest.Api/WeatherForecast.cs similarity index 100% rename from BlueWest.WebApi/WeatherForecast.cs rename to BlueWest.Api/WeatherForecast.cs diff --git a/BlueWest.WebApi/appsettings.Development.json b/BlueWest.Api/appsettings.Development.json similarity index 100% rename from BlueWest.WebApi/appsettings.Development.json rename to BlueWest.Api/appsettings.Development.json diff --git a/BlueWest.WebApi/appsettings.json b/BlueWest.Api/appsettings.json similarity index 100% rename from BlueWest.WebApi/appsettings.json rename to BlueWest.Api/appsettings.json diff --git a/BlueWest.Data/User/User.cs b/BlueWest.Data/User/User.cs index 2f8fc67..f9366bd 100644 --- a/BlueWest.Data/User/User.cs +++ b/BlueWest.Data/User/User.cs @@ -21,7 +21,7 @@ namespace BlueWest.Data [Key(8)] public FastDictionary FinanceTransactions { get; } - public User(TimeSpan id, string name, string address, string btcAddress, string ltcAddress, double btcAmount, double ltcAmount, FastDictionary financeTransactions) + public User(TimeSpan id, string name, FastDictionary financeTransactions) { Id = id; Name = name; diff --git a/BlueWest.sln b/BlueWest.sln index 5c52168..c1a3a48 100644 --- a/BlueWest.sln +++ b/BlueWest.sln @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest", "BlueWest\BlueWe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Data", "BlueWest.Data\BlueWest.Data.csproj", "{E518C62D-768C-4885-9C9D-FD5761605B54}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.WebApi", "BlueWest.WebApi\BlueWest.WebApi.csproj", "{6D3321B5-CF1A-4251-B28D-329EDA6DC278}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Api", "BlueWest.Api\BlueWest.Api.csproj", "{6D3321B5-CF1A-4251-B28D-329EDA6DC278}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Collections", "BlueWest.Collections\BlueWest.Collections.csproj", "{F55019A2-E2A8-4AF1-8FBC-FA99476A1B1C}" EndProject diff --git a/BlueWest/Data/MemoryData.cs b/BlueWest/Data/MemoryData.cs index 1aef72c..fd1790f 100644 --- a/BlueWest/Data/MemoryData.cs +++ b/BlueWest/Data/MemoryData.cs @@ -40,14 +40,12 @@ namespace PerformanceSolution.Data } public static FinanceTransaction GetTransactionById(int userId, int transactionId) => UserList.GetTransactionById(userId, transactionId); - - + private static void SaveUserList() => SaveUserList(UserList); public static User AddOrModifyUser(UserUpdateDto userUpdateDto, int userId = -1) { return UserList.AddUser(userId, userUpdateDto); - } private static UserList GenerateMockData() @@ -56,7 +54,7 @@ namespace PerformanceSolution.Data var transactions = new FastDictionary(); - var u = new User(DateTime.Now.TimeOfDay, "Rui Sousa", "Sagres", "NOADD", "NOADD", 0, 0, transactions); + var u = new User(DateTime.Now.TimeOfDay, "Benny", transactions); var list = new FastDictionary(10); var financeTransaction = new FinanceTransaction(TimeSpan.FromTicks(DateTime.Now.Ticks), u.Id, "", 0.00, 0.00, 0.00, TimeSpan.FromTicks(DateTime.Now.Ticks), TimeSpan.FromTicks(DateTime.Now.Ticks)); diff --git a/BlueWest/Program.cs b/BlueWest/Program.cs deleted file mode 100644 index 31420de..0000000 --- a/BlueWest/Program.cs +++ /dev/null @@ -1,10 +0,0 @@ -using BlueWest.Core; - -class Program -{ - public static void Main() - { - new BlueProgram().Run(); - } -} -