From f696e815df831f07fa94880ee472cc28006e70c8 Mon Sep 17 00:00:00 2001 From: Muqimjon Mamadaliyev Date: Thu, 1 Feb 2024 09:26:08 +0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=20Optimized=20configuration=20retr?= =?UTF-8?q?ieval?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetAllRepresentationAppsByUserId.cs | 4 +- .../DependencyInjection.cs | 22 ++--- .../EcoLink.Infrastructure.csproj | 1 + .../Investment/InvestmentAppsController.cs | 2 +- .../RepresentationAppsController.cs | 2 +- src/backend/EcoLink.WebApi/appsettings.json | 4 +- .../RepresentationAppService.cs | 2 +- .../Resources/BotLocalizer.uz.resx | 86 +++++++++---------- src/frontend/EcoLink.Bot/appsettings.json | 2 +- 9 files changed, 58 insertions(+), 67 deletions(-) diff --git a/src/backend/EcoLink.Application/RepresentationApps/Queries/GetRepresentationApps/GetAllRepresentationAppsByUserId.cs b/src/backend/EcoLink.Application/RepresentationApps/Queries/GetRepresentationApps/GetAllRepresentationAppsByUserId.cs index 1fbfba8..28e7ee8 100644 --- a/src/backend/EcoLink.Application/RepresentationApps/Queries/GetRepresentationApps/GetAllRepresentationAppsByUserId.cs +++ b/src/backend/EcoLink.Application/RepresentationApps/Queries/GetRepresentationApps/GetAllRepresentationAppsByUserId.cs @@ -1,6 +1,4 @@ -using EcoLink.Application.RepresentationApps.DTOs; - -namespace EcoLink.Application.RepresentationApps.Queries.GetRepresentationApp; +namespace EcoLink.Application.RepresentationApps.Queries.GetRepresentationApp; public record GetAllRepresentationAppsByUserIdQuery : IRequest> { diff --git a/src/backend/EcoLink.Infrastructure/DependencyInjection.cs b/src/backend/EcoLink.Infrastructure/DependencyInjection.cs index d36e6e0..8742e73 100644 --- a/src/backend/EcoLink.Infrastructure/DependencyInjection.cs +++ b/src/backend/EcoLink.Infrastructure/DependencyInjection.cs @@ -23,27 +23,19 @@ public static IServiceCollection AddInfrastructureServices( options.UseNpgsql(configuration.GetConnectionString(name: "DefaultConnection"))); // Add sheets service - #region Add Sheets configure - #region Google Auth Settings converting to json - GoogleAuthSettings googleAuth = new(); - - var properties = typeof(GoogleAuthSettings).GetProperties(); - foreach (var property in properties) - property.SetValue(obj: googleAuth, value: configuration[property.Name] ?? string.Empty); - #endregion - - services.AddSingleton(new SheetsConfigure() + services.AddSingleton(implementationInstance: new SheetsConfigure() { SpreadsheetId = configuration.GetConnectionString(name: "SpreadsheetId")!, - Service = new SheetsService(new BaseClientService.Initializer() + Service = new SheetsService(initializer: new BaseClientService.Initializer() { HttpClientInitializer = GoogleCredential.FromJson( - json: JsonConvert.SerializeObject(googleAuth)) + json: JsonConvert.SerializeObject( + value: configuration.GetSection( + key: nameof(GoogleAuthSettings)). + Get())), }), - Sheets = JsonConvert.DeserializeObject( - value: configuration["Sheets"]!)! + Sheets = configuration.GetSection(key: nameof(Sheets)).Get()! }); - #endregion // Add repositories services.AddScoped(serviceType: typeof(IRepository<>), implementationType: typeof(Repository<>)); diff --git a/src/backend/EcoLink.Infrastructure/EcoLink.Infrastructure.csproj b/src/backend/EcoLink.Infrastructure/EcoLink.Infrastructure.csproj index 7fc13d1..c087a8e 100644 --- a/src/backend/EcoLink.Infrastructure/EcoLink.Infrastructure.csproj +++ b/src/backend/EcoLink.Infrastructure/EcoLink.Infrastructure.csproj @@ -12,6 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs b/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs index c08a2a7..3c39fae 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs @@ -23,7 +23,7 @@ public async Task UpdateStatus(UpdateInvestmentStatusCommand comm public async Task Get(long id, CancellationToken cancellationToken) => Ok(new Response { Data = await mediator.Send(new GetInvestmentAppQuery(id), cancellationToken) }); - [HttpGet("get-all-by-user-user-id/{userId:long}")] + [HttpGet("get-all-by-user-id/{userId:long}")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] public async Task GetAllByUserId(long userId, CancellationToken cancellationToken) => Ok(new Response { Data = await mediator.Send(new GetAllInvestmentAppsByUserIdQuery(userId), cancellationToken) }); diff --git a/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs b/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs index 73953ba..639afd9 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs @@ -25,5 +25,5 @@ public async Task Get(long id, CancellationToken cancellationToke [HttpGet("get-all-by-user-id/{userId:long}")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] public async Task GetAllByUserId(long userId, CancellationToken cancellationToken) - => Ok(new Response { Data = await mediator.Send(new GetRepresentationAppByIdQuery(userId), cancellationToken) }); + => Ok(new Response { Data = await mediator.Send(new GetAllRepresentationAppsByUserIdQuery(userId), cancellationToken) }); } diff --git a/src/backend/EcoLink.WebApi/appsettings.json b/src/backend/EcoLink.WebApi/appsettings.json index fcb7ec4..d418c4c 100644 --- a/src/backend/EcoLink.WebApi/appsettings.json +++ b/src/backend/EcoLink.WebApi/appsettings.json @@ -7,9 +7,9 @@ }, "Sheets": { "Investment": "Investment!A:I", - "Entrepreneur": "Entrepreneurship!A:L", "Representation": "Representation!A:L", - "ProjectManager": "ProjectManagement!A:K" + "Entrepreneurship": "Entrepreneurship!A:L", + "ProjectManagement": "ProjectManagement!A:K" }, "AllowedHosts": "*" } diff --git a/src/frontend/EcoLink.ApiService/Services/Representation/RepresentationAppService.cs b/src/frontend/EcoLink.ApiService/Services/Representation/RepresentationAppService.cs index 5d48f97..b3b4a7a 100644 --- a/src/frontend/EcoLink.ApiService/Services/Representation/RepresentationAppService.cs +++ b/src/frontend/EcoLink.ApiService/Services/Representation/RepresentationAppService.cs @@ -41,7 +41,7 @@ public async Task GetLastAsync(long id, CancellationToken if (!response.IsSuccessStatusCode || response.StatusCode is HttpStatusCode.NoContent) return default!; - var result = await response.Content.ReadFromJsonAsync>>(cancellationToken: cancellationToken); + var result = await response.Content.ReadFromJsonAsync>>(cancellationToken: cancellationToken); if (result!.Status == 200) return result.Data.LastOrDefault()!; diff --git a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx index 78ef83f..86db6f2 100644 --- a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx +++ b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx @@ -272,99 +272,99 @@ O'zingiz uchun qulay tilni tanlang: Ism: - {0} +↳ {0} Familiya: - {1} +↳ {1} Yoshi: - {2} +↳ {2} Ma'lumoti: - {3} +↳ {3} Ish tajribasi: - {4} +↳ {4} Loyiha haqida: - {5} +↳ {5} Yordam turi: - {6} +↳ {6} Kerakli summa: - {7} +↳ {7} Tikiladigan aktiv: - {8} +↳ {8} Telefon raqami: - {9} +↳ {9} Email: - {10} +↳ {10} Tayyor Arizani tasdiqlash uchun foydalanuvchiga to'liq holda taqdim qilish uchun tadbirkor ma'lumotlari Ism: - {0} +↳ {0} Familiya: - {1} +↳ {1} Yoshi: - {2} +↳ {2} Ma'lumoti: - {3} +↳ {3} Sektor: - {4} +↳ {4} Yordam: - {5} +↳ {5} Telefon raqami: - {6} +↳ {6} Email: - {7} +↳ {7} Tayyor Arizani tasdiqlash uchun foydalanuvchiga to'liq holda taqdim qilish uchun investor ma'lumotlari Ism: - {0} +↳ {0} Familiya: - {1} +↳ {1} Yoshi: - {2} +↳ {2} Ma'lumoti: - {3} +↳ {3} Til ko'nikmasi: - {4} +↳ {4} Ish tajribasi: - {5} +↳ {5} Manzili: - {6} +↳ {6} Loyiha yo'nalishi: - {7} +↳ {7} Iqtisodiyot assambleyasidan kutuv: - {8} +↳ {8} Vakil bo'lishdan maqsad: - {9} +↳ {9} Telefon raqami: - {10} +↳ {10} Email: - {11} +↳ {11} Ism: - {0} +↳ {0} Familiya: - {1} +↳ {1} Yoshi: - {2} +↳ {2} Ma'lumoti: - {3} +↳ {3} Til ko'nikmasi: - {4} +↳ {4} Ish tajribasi: - {5} +↳ {5} Manzili: - {6} +↳ {6} Vakillik manzili: - {7} +↳ {7} Iqtisodiyot assambleyasidan kutuv: - {8} +↳ {8} Vakil bo'lishdan maqsad: - {9} +↳ {9} Telefon raqami: - {10} +↳ {10} Email: - {11} +↳ {11} O'xbekiston Iqtisodiyot Assambleyasi tashkilotining rivoji uchun yana qanday ishlar qilishimiz mumkinligi haqida o'z fikringizni qoldiring. Bu biz uchun juda muhim! diff --git a/src/frontend/EcoLink.Bot/appsettings.json b/src/frontend/EcoLink.Bot/appsettings.json index 10f68b8..ec04bc1 100644 --- a/src/frontend/EcoLink.Bot/appsettings.json +++ b/src/frontend/EcoLink.Bot/appsettings.json @@ -6,4 +6,4 @@ } }, "AllowedHosts": "*" -} +} \ No newline at end of file