From ab9cfbe98c69ae5f4f16dc74f7f3c67efb4d2cff Mon Sep 17 00:00:00 2001 From: Muqimjon Mamadaliyev Date: Tue, 23 Jan 2024 18:04:27 +0500 Subject: [PATCH] =?UTF-8?q?Revert=20"=F0=9F=A4=96=20API=20Client=20service?= =?UTF-8?q?=20added"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 57495ba12278b6f5050ef505db961a048f66ae45. --- .../Extensions/CollectionExtensions.cs | 12 -- .../Commons/Helpers/TimeHelper.cs | 4 + .../EcoLink.Application.csproj | 2 - .../Users/Commands/CreateUsers/CreateUser.cs | 2 + .../CreateUsers/CreateUserWithReturn.cs | 4 +- .../Users/Commands/UpdateUsers/UpdateUser.cs | 2 - .../Users/DTOs/UserResultDto.cs | 3 +- .../Users/Queries/GetUsers/GetAllUsers.cs | 3 +- .../Queries/GetUsers/GetUserByTelegramId.cs | 37 +---- .../EcoLink.Domain/Configurations/Filter.cs | 7 - .../Configurations/PaginationMetaData.cs | 10 -- .../Configurations/PaginationParams.cs | 13 -- src/backend/EcoLink.Domain/Enums/State.cs | 5 +- .../EntrepreneursController.cs | 28 ++-- .../EntrepreneurshipAppsController.cs | 13 +- .../Investment/InvestmentAppsController.cs | 12 +- .../Investment/InvestorsController.cs | 28 ++-- .../ProjectManagementAppsController.cs | 12 +- .../ProjectManagersController.cs | 28 ++-- .../RepresentationAppsController.cs | 15 +- .../RepresentativeController.cs | 28 ++-- .../Controllers/Users/UsersController.cs | 28 ++-- .../EcoLink.WebApi/EcoLink.WebApi.csproj | 2 +- src/backend/EcoLink.WebApi/GlobalUsing.cs | 1 - src/backend/EcoLink.WebApi/Models/Response.cs | 8 - src/backend/EcoLink.WebApi/Program.cs | 12 +- .../Constants/TimeConstats.cs | 7 - .../EcoLink.ApiService/DependencyInjection.cs | 19 --- .../EcoLink.ApiService.csproj | 2 +- .../EcoLink.ApiService/GlobalUsing.cs | 8 +- .../Helpers/ConvertHelper.cs | 42 +++--- .../Interfaces/IUserService.cs | 10 +- .../Models/Commons/Response.cs | 8 - .../Models/Entrepreneurship/Entrepreneur.cs | 10 -- .../Models/Investment/Investor.cs | 8 - .../ProjectManagement/ProjectManager.cs | 9 -- .../Models/Representation/Representative.cs | 9 -- .../Models/Users/UserDto.cs | 3 +- .../Services/EmployeeService.cs | 62 ++++++++ .../Services/UserService.cs | 82 ---------- .../BotServices/Commons/BotUpdateHandler.cs | 29 ++-- ...UpdateHandler.CallbackQuery.Application.cs | 12 +- .../BotUpdateHandler.CallbackQuery.cs | 40 +++-- ...Handler.Message.Text.Application.Helper.cs | 15 +- .../Handlers/BotUpdateHandler.Message.Text.cs | 2 +- .../BotUpdateHandler.SendApplication.cs | 142 +++++++++++------- .../Senders/BotUpdateHandler.SendOther.cs | 21 ++- src/frontend/EcoLink.Bot/EcoLink.Bot.csproj | 3 +- src/frontend/EcoLink.Bot/Program.cs | 4 - .../Resources/BotLocalizer.en.resx | 7 +- .../Resources/BotLocalizer.ru.resx | 19 ++- .../Resources/BotLocalizer.uz.resx | 3 - 52 files changed, 390 insertions(+), 505 deletions(-) delete mode 100644 src/backend/EcoLink.Application/Commons/Extensions/CollectionExtensions.cs delete mode 100644 src/backend/EcoLink.Domain/Configurations/Filter.cs delete mode 100644 src/backend/EcoLink.Domain/Configurations/PaginationMetaData.cs delete mode 100644 src/backend/EcoLink.Domain/Configurations/PaginationParams.cs delete mode 100644 src/backend/EcoLink.WebApi/GlobalUsing.cs delete mode 100644 src/backend/EcoLink.WebApi/Models/Response.cs delete mode 100644 src/frontend/EcoLink.ApiService/Constants/TimeConstats.cs delete mode 100644 src/frontend/EcoLink.ApiService/DependencyInjection.cs delete mode 100644 src/frontend/EcoLink.ApiService/Models/Commons/Response.cs delete mode 100644 src/frontend/EcoLink.ApiService/Models/Entrepreneurship/Entrepreneur.cs delete mode 100644 src/frontend/EcoLink.ApiService/Models/Investment/Investor.cs delete mode 100644 src/frontend/EcoLink.ApiService/Models/ProjectManagement/ProjectManager.cs delete mode 100644 src/frontend/EcoLink.ApiService/Models/Representation/Representative.cs create mode 100644 src/frontend/EcoLink.ApiService/Services/EmployeeService.cs delete mode 100644 src/frontend/EcoLink.ApiService/Services/UserService.cs diff --git a/src/backend/EcoLink.Application/Commons/Extensions/CollectionExtensions.cs b/src/backend/EcoLink.Application/Commons/Extensions/CollectionExtensions.cs deleted file mode 100644 index b5bd59c..0000000 --- a/src/backend/EcoLink.Application/Commons/Extensions/CollectionExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using EcoLink.Domain.Configurations; - -namespace EcoLink.Service.Extensions; - -public static class CollectionExtensions -{ - public static IQueryable ToPaginate(this IQueryable values, PaginationParams @params) - { - var source = values.Skip((@params.PageIndex - 1) * @params.PageSize).Take(@params.PageSize); - return source; - } -} \ No newline at end of file diff --git a/src/backend/EcoLink.Application/Commons/Helpers/TimeHelper.cs b/src/backend/EcoLink.Application/Commons/Helpers/TimeHelper.cs index c5a9a57..b423f9e 100644 --- a/src/backend/EcoLink.Application/Commons/Helpers/TimeHelper.cs +++ b/src/backend/EcoLink.Application/Commons/Helpers/TimeHelper.cs @@ -4,4 +4,8 @@ public class TimeHelper { public static DateTimeOffset GetDateTime() => DateTimeOffset.UtcNow.AddHours(TimeConstants.UTC); + + public static int GetAge(DateTimeOffset dateOfBirth) + => DateTimeOffset.UtcNow.Year - dateOfBirth.Year - (DateTimeOffset.UtcNow < dateOfBirth.AddYears( + DateTimeOffset.UtcNow.Year - dateOfBirth.Year) ? 1 : 0); } diff --git a/src/backend/EcoLink.Application/EcoLink.Application.csproj b/src/backend/EcoLink.Application/EcoLink.Application.csproj index 095ac83..d8078db 100644 --- a/src/backend/EcoLink.Application/EcoLink.Application.csproj +++ b/src/backend/EcoLink.Application/EcoLink.Application.csproj @@ -10,8 +10,6 @@ - - diff --git a/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUser.cs b/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUser.cs index 12bb762..33afe7b 100644 --- a/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUser.cs +++ b/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUser.cs @@ -5,6 +5,7 @@ public record class CreateUserCommand : IRequest public CreateUserCommand(CreateUserCommand command) { Age = command.Age; + State = command.State; Phone = command.Phone; Email = command.Email; IsBot = command.IsBot; @@ -40,6 +41,7 @@ public CreateUserCommand(CreateUserCommand command) public string LanguageCode { get; set; } = string.Empty; public long ChatId { get; set; } public bool IsBot { get; set; } + public State State { get; set; } } public class CreateUserCommandHandler(IRepository repository, IMapper mapper) : IRequestHandler diff --git a/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUserWithReturn.cs b/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUserWithReturn.cs index 5b29104..a7753c4 100644 --- a/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUserWithReturn.cs +++ b/src/backend/EcoLink.Application/Users/Commands/CreateUsers/CreateUserWithReturn.cs @@ -13,12 +13,12 @@ public CreateUserWithReturnCommand(CreateUserWithReturnCommand command) Address = command.Address; Username = command.Username; LastName = command.LastName; - FirstName = command.FirstName; Languages = command.Languages; + FirstName = command.FirstName; TelegramId = command.TelegramId; Patronomyc = command.Patronomyc; - Profession = command.Profession; Experience = command.Experience; + Profession = command.Profession; DateOfBirth = command.DateOfBirth; LanguageCode = command.LanguageCode; } diff --git a/src/backend/EcoLink.Application/Users/Commands/UpdateUsers/UpdateUser.cs b/src/backend/EcoLink.Application/Users/Commands/UpdateUsers/UpdateUser.cs index f52dcf9..170f2a7 100644 --- a/src/backend/EcoLink.Application/Users/Commands/UpdateUsers/UpdateUser.cs +++ b/src/backend/EcoLink.Application/Users/Commands/UpdateUsers/UpdateUser.cs @@ -9,7 +9,6 @@ public UpdateUserCommand(UpdateUserCommand command) Phone = command.Phone; Email = command.Email; IsBot = command.IsBot; - State = command.State; Degree = command.Degree; ChatId = command.ChatId; Address = command.Address; @@ -39,7 +38,6 @@ public UpdateUserCommand(UpdateUserCommand command) public string Languages { get; set; } = string.Empty; public string Experience { get; set; } = string.Empty; public UserProfession Profession { get; set; } - public State State { get; set; } public long TelegramId { get; set; } public string UserName { get; set; } = string.Empty; public string LanguageCode { get; set; } = string.Empty; diff --git a/src/backend/EcoLink.Application/Users/DTOs/UserResultDto.cs b/src/backend/EcoLink.Application/Users/DTOs/UserResultDto.cs index b74b888..d29bc0b 100644 --- a/src/backend/EcoLink.Application/Users/DTOs/UserResultDto.cs +++ b/src/backend/EcoLink.Application/Users/DTOs/UserResultDto.cs @@ -15,9 +15,8 @@ public class UserResultDto public string Languages { get; set; } = string.Empty; public string Experience { get; set; } = string.Empty; public UserProfession Profession { get; set; } - public State State { get; set; } public long TelegramId { get; set; } - public string Username { get; set; } = string.Empty; + public string UserName { get; set; } = string.Empty; public string LanguageCode { get; set; } = string.Empty; public long ChatId { get; set; } public bool IsBot { get; set; } diff --git a/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetAllUsers.cs b/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetAllUsers.cs index e34d970..68cfb3c 100644 --- a/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetAllUsers.cs +++ b/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetAllUsers.cs @@ -9,6 +9,5 @@ public record GetAllUsersQuery : IRequest> public class GetAllUsersQueryHandler(IRepository repository, IMapper mapper) : IRequestHandler> { public async Task> Handle(GetAllUsersQuery request, CancellationToken cancellationToken) - => mapper.Map>(await Task.Run(() => repository.SelectAll())) - ?? throw new NotFoundException($"User is not found with ID = {request.Id}"); + => mapper.Map>(await Task.Run(() => repository.SelectAll())); } diff --git a/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetUserByTelegramId.cs b/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetUserByTelegramId.cs index e3b8a94..aa63836 100644 --- a/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetUserByTelegramId.cs +++ b/src/backend/EcoLink.Application/Users/Queries/GetUsers/GetUserByTelegramId.cs @@ -1,9 +1,4 @@ -using EcoLink.Application.Investors.DTOs; -using EcoLink.Application.Entrepreneurs.DTOs; -using EcoLink.Application.ProjectManagers.DTOs; -using EcoLink.Application.Representatives.DTOs; - -namespace EcoLink.Application.Users.Queries.GetUsers; +namespace EcoLink.Application.Users.Queries.GetUsers; public record GetUserByTelegramIdQuery : IRequest { @@ -11,34 +6,8 @@ public record GetUserByTelegramIdQuery : IRequest public long TelegramId { get; set; } } -public class GetUserByTelegramIdQueryHandler(IMapper mapper, - IRepository repository, - IRepository investorRepository, - IRepository entrepreneurRepository, - IRepository representativeRepository, - IRepository projectManagerRepository) : - IRequestHandler +public class GetUserByTelegramIdQueryHandler(IRepository repository, IMapper mapper) : IRequestHandler { public async Task Handle(GetUserByTelegramIdQuery request, CancellationToken cancellationToken) - { - var resultDto = mapper.Map(await repository.SelectAsync(i => i.TelegramId == request.TelegramId)) - ?? throw new NotFoundException($"User is not found with Telegram ID = {request.TelegramId}"); - - switch(resultDto.Profession) - { - case UserProfession.Investor: - resultDto.Application = mapper.Map(await investorRepository.SelectAsync(i => i.UserId == resultDto.Id)); - break; - case UserProfession.Entrepreneur: - resultDto.Application = mapper.Map(await entrepreneurRepository.SelectAsync(i => i.UserId == resultDto.Id)); - break; - case UserProfession.Representative: - resultDto.Application = mapper.Map(await representativeRepository.SelectAsync(i => i.UserId == resultDto.Id)); - break; - case UserProfession.ProjectManager: - resultDto.Application = mapper.Map(await projectManagerRepository.SelectAsync(i => i.UserId == resultDto.Id)); - break; - }; - return resultDto; - } + => mapper.Map(await repository.SelectAsync(i => i.TelegramId == request.TelegramId)); } diff --git a/src/backend/EcoLink.Domain/Configurations/Filter.cs b/src/backend/EcoLink.Domain/Configurations/Filter.cs deleted file mode 100644 index a105012..0000000 --- a/src/backend/EcoLink.Domain/Configurations/Filter.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace EcoLink.Domain.Configurations; - -public class Filter -{ - public string OrderBy { get; set; } - public bool IsDesc { get; set; } -} diff --git a/src/backend/EcoLink.Domain/Configurations/PaginationMetaData.cs b/src/backend/EcoLink.Domain/Configurations/PaginationMetaData.cs deleted file mode 100644 index 1d2df73..0000000 --- a/src/backend/EcoLink.Domain/Configurations/PaginationMetaData.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace EcoLink.Domain.Configurations; - -public class PaginationMetaData(int totalCount, PaginationParams @params) -{ - public int CurrentPage { get; set; } = @params.PageIndex; - public int TotalPages { get; set; } = (int)Math.Ceiling(totalCount / (double)@params.PageSize); - public int TotalCount { get; set; } = totalCount; - public bool HasPrevious => CurrentPage > 1; - public bool HasNext => CurrentPage < TotalPages; -} diff --git a/src/backend/EcoLink.Domain/Configurations/PaginationParams.cs b/src/backend/EcoLink.Domain/Configurations/PaginationParams.cs deleted file mode 100644 index a0be151..0000000 --- a/src/backend/EcoLink.Domain/Configurations/PaginationParams.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace EcoLink.Domain.Configurations; - -public class PaginationParams -{ - private const int maxSize = 20; - private int pageSize; - public int PageSize - { - get => pageSize == 0 ? 10 : pageSize; - set { pageSize = value > maxSize ? maxSize : (value <= 0 ? 1 : value); } - } - public int PageIndex { get; set; } = 1; -} \ No newline at end of file diff --git a/src/backend/EcoLink.Domain/Enums/State.cs b/src/backend/EcoLink.Domain/Enums/State.cs index eba3ff8..89c5685 100644 --- a/src/backend/EcoLink.Domain/Enums/State.cs +++ b/src/backend/EcoLink.Domain/Enums/State.cs @@ -2,7 +2,6 @@ public enum State { - NewUser, None, WaitingForSubmitApplication, WaitingForSelectLanguage, @@ -12,7 +11,6 @@ public enum State WaitingForSelectProfession, WaitingForEnterPatronomyc, WaitingForEnterDateOfBirth, - WaitingForEnterAge, WaitingForEnterDegree, WaitingForEnterSector, WaitingForEnterInvestmentAmount, @@ -32,11 +30,12 @@ public enum State WaitingForEnterProjectDirection, WaitingForSelectSettings, WaitingForSelectForFeedback, - WaitingForSelectForEditPersonalInfo, + WaitingForSelectPersonalInfo, WaitingForFeedbackForOrganization, WaitingForFeedbackForTelegramBot, WaitingForSelectEntrepreneurshipMenu, WaitingForSelectInvestmentMenu, WaitingForSelectProjectManagementMenu, WaitingForSelectRepresentationMenu, + WaitingForEnterAge, } diff --git a/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneursController.cs b/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneursController.cs index dc6aca0..630c180 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneursController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneursController.cs @@ -10,36 +10,36 @@ public class EntrepreneursController(IMediator mediator) : BaseController { [HttpPost("create")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Create(CreateEntrepreneurCommand command, CancellationToken cancellationToken = default) - => Ok(await mediator.Send(new CreateEntrepreneurCommand(command), cancellationToken)); + public async Task Create(CreateEntrepreneurCommand command) + => Ok(await mediator.Send(new CreateEntrepreneurCommand(command))); [HttpPost("create-with-return")] [ProducesResponseType(typeof(EntrepreneurResultDto), StatusCodes.Status200OK)] - public async Task Create(CreateEntrepreneurshipAppWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateEntrepreneurshipAppWithReturnCommand(command), cancellationToken) }); + public async Task Create(CreateEntrepreneurshipAppWithReturnCommand command) + => Ok(await mediator.Send(new CreateEntrepreneurshipAppWithReturnCommand(command))); [HttpPut("update")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Update(UpdateEntrepreneurCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new UpdateEntrepreneurCommand(command), cancellationToken) }); + public async Task Update(UpdateEntrepreneurCommand command) + => Ok(await mediator.Send(new UpdateEntrepreneurCommand(command))); [HttpDelete("delete/{id:long}")] [ProducesResponseType(typeof(bool), StatusCodes.Status200OK)] - public async Task Delete(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new DeleteEntrepreneurCommand(id), cancellationToken) }); + public async Task Delete(long id) + => Ok(await mediator.Send(new DeleteEntrepreneurCommand(id))); [HttpGet("get/{id:long}")] [ProducesResponseType(typeof(EntrepreneurResultDto), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetEntrepreneurQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetEntrepreneurQuery(id))); [HttpGet("get-by-userId/{userId:long}")] [ProducesResponseType(typeof(EntrepreneurResultDto), StatusCodes.Status200OK)] - public async Task GetByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetEntrepreneurByUserIdQuery(userId), cancellationToken) }); + public async Task GetByUserId(long userId) + => Ok(await mediator.Send(new GetEntrepreneurByUserIdQuery(userId))); [HttpGet("get-all")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAll(CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllEntrepreneursQuery(), cancellationToken) }); + public async Task GetAll() + => Ok(await mediator.Send(new GetAllEntrepreneursQuery())); } diff --git a/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneurshipAppsController.cs b/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneurshipAppsController.cs index f1fd761..beff890 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneurshipAppsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneurshipAppsController.cs @@ -1,21 +1,20 @@ using EcoLink.Application.Entrepreneurs.Commands.CreateEntrepreneurs; using EcoLink.Application.EntrepreneurshipApps.Queries.GetEntrepreneurshipApp; - namespace EcoLink.WebApi.Controllers.Entrepreneurship; public class EntrepreneurshipAppsController(IMediator mediator) : BaseController { [HttpPost("create")] - public async Task Create(CreateEntrepreneurshipAppWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateEntrepreneurshipAppWithReturnCommand(command), cancellationToken) }); + public async Task Create(CreateEntrepreneurshipAppWithReturnCommand command) + => Ok(await mediator.Send(new CreateEntrepreneurshipAppWithReturnCommand(command))); [HttpGet("get-all-by-user-id/{userId:long}")] - public async Task GetAllByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllEntrepreneurshipAppsByUserIdQuery(userId), cancellationToken) }); + public async Task GetAllByUserId(long userId) + => Ok(await mediator.Send(new GetAllEntrepreneurshipAppsByUserIdQuery(userId))); [HttpGet("get/{id:long}")] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetEntrepreneurshipAppByIdCommand(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetEntrepreneurshipAppByIdCommand(id))); } diff --git a/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs b/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs index d067f85..297ffde 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Investment/InvestmentAppsController.cs @@ -9,16 +9,16 @@ public class InvestmentAppsController(IMediator mediator) : BaseController { [HttpPost("create")] [ProducesResponseType(typeof(InvestmentAppResultDto), StatusCodes.Status200OK)] - public async Task Create(CreateInvestmentAppWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateInvestmentAppWithReturnCommand(command), cancellationToken) }); + public async Task Create(CreateInvestmentAppWithReturnCommand command) + => Ok(await mediator.Send(new CreateInvestmentAppWithReturnCommand(command))); [HttpGet("get-all-by-user-userId/{userId:long}")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAllByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllInvestmentAppsByUserIdQuery(userId), cancellationToken) }); + public async Task GetAllByUserId(long userId) + => Ok(await mediator.Send(new GetAllInvestmentAppsByUserIdQuery(userId))); [HttpGet("get/{userId:long}")] [ProducesResponseType(typeof(InvestmentAppResultDto), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetInvestmentAppQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetInvestmentAppQuery(id))); } diff --git a/src/backend/EcoLink.WebApi/Controllers/Investment/InvestorsController.cs b/src/backend/EcoLink.WebApi/Controllers/Investment/InvestorsController.cs index 13f226f..1a1ed60 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Investment/InvestorsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Investment/InvestorsController.cs @@ -10,36 +10,36 @@ public class InvestorsController(IMediator mediator) : BaseController { [HttpPost("create")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Create(CreateInvestorCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateInvestorCommand(command), cancellationToken) }); + public async Task Create(CreateInvestorCommand command) + => Ok(await mediator.Send(new CreateInvestorCommand(command))); [HttpPost("create-with-return")] [ProducesResponseType(typeof(InvestorResultDto), StatusCodes.Status200OK)] - public async Task CreateWithReturn(CreateInvestorWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateInvestorWithReturnCommand(command), cancellationToken) }); + public async Task CreateWithReturn(CreateInvestorWithReturnCommand command) + => Ok(await mediator.Send(new CreateInvestorWithReturnCommand(command))); [HttpPut("update")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Update(UpdateInvestorCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new UpdateInvestorCommand(command), cancellationToken) }); + public async Task Update(UpdateInvestorCommand command) + => Ok(await mediator.Send(new UpdateInvestorCommand(command))); [HttpDelete("delete/{id:long}")] [ProducesResponseType(typeof(bool), StatusCodes.Status200OK)] - public async Task Delete(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new DeleteInvestorCommand(id), cancellationToken) }); + public async Task Delete(long id) + => Ok(await mediator.Send(new DeleteInvestorCommand(id))); [HttpGet("get/{id:long}")] [ProducesResponseType(typeof(InvestorResultDto), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetInvestorQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetInvestorQuery(id))); [HttpGet("get-by-user-id/{userId:long:}")] [ProducesResponseType(typeof(InvestorResultDto), StatusCodes.Status200OK)] - public async Task GetByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetInvestorByUserIdQuery(userId), cancellationToken) }); + public async Task GetByUserId(long userId) + => Ok(await mediator.Send(new GetInvestorByUserIdQuery(userId))); [HttpGet("get-all")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAll(CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllInvestorsQuery(), cancellationToken) }); + public async Task GetAll() + => Ok(await mediator.Send(new GetAllInvestorsQuery())); } \ No newline at end of file diff --git a/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagementAppsController.cs b/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagementAppsController.cs index 62a6c3d..e7cb98f 100644 --- a/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagementAppsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagementAppsController.cs @@ -8,16 +8,16 @@ public class ProjectManagementAppsController(IMediator mediator) : BaseControlle { [HttpPost("create")] [ProducesResponseType(typeof(ProjectManagerResultDto), StatusCodes.Status200OK)] - public async Task Create(CreateProjectManagementAppWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateProjectManagementAppWithReturnCommand(command), cancellationToken) }); + public async Task Create(CreateProjectManagementAppWithReturnCommand command) + => Ok(await mediator.Send(new CreateProjectManagementAppWithReturnCommand(command))); [HttpGet("get/{id:long}")] [ProducesResponseType(typeof(ProjectManagerResultDto), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetProjectManagementAppQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetProjectManagementAppQuery(id))); [HttpGet("get-all-by-user-id/{userId:long}")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAllByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllProjectManagementAppsByUserIdQuery(userId), cancellationToken) }); + public async Task GetAllByUserId(long userId) + => Ok(await mediator.Send(new GetAllProjectManagementAppsByUserIdQuery(userId))); } diff --git a/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagersController.cs b/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagersController.cs index 5e4c028..d65fb53 100644 --- a/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagersController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/ProjectManagement/ProjectManagersController.cs @@ -10,36 +10,36 @@ public class ProjectManagersController(IMediator mediator) : BaseController { [HttpPost("create")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Create(CreateProjectManagerCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateProjectManagerCommand(command), cancellationToken) }); + public async Task Create(CreateProjectManagerCommand command) + => Ok(await mediator.Send(new CreateProjectManagerCommand(command))); [HttpPost("create-with-return")] [ProducesResponseType(typeof(ProjectManagerResultDto), StatusCodes.Status200OK)] - public async Task CreateWithReturn(CreateProjectManagerWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateProjectManagerWithReturnCommand(command), cancellationToken) }); + public async Task CreateWithReturn(CreateProjectManagerWithReturnCommand command) + => Ok(await mediator.Send(new CreateProjectManagerWithReturnCommand(command))); [HttpPut("update")] [ProducesResponseType(typeof(ProjectManagerResultDto), StatusCodes.Status200OK)] - public async Task Update(UpdateProjectManagerCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new UpdateProjectManagerCommand(command), cancellationToken) }); + public async Task Update(UpdateProjectManagerCommand command) + => Ok(await mediator.Send(new UpdateProjectManagerCommand(command))); [HttpDelete("delete/{id:long}")] [ProducesResponseType(typeof(bool), StatusCodes.Status200OK)] - public async Task Delete(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new DeleteProjectManagerCommand(id), cancellationToken) }); + public async Task Delete(long id) + => Ok(await mediator.Send(new DeleteProjectManagerCommand(id))); [HttpGet("get/{id:long}")] [ProducesResponseType(typeof(ProjectManagerResultDto), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetProjectManagerQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetProjectManagerQuery(id))); [HttpGet("get-by-user-id/{userId:long}")] [ProducesResponseType(typeof(ProjectManagerResultDto), StatusCodes.Status200OK)] - public async Task GetByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetProjectManagerByUserIdQuery(userId), cancellationToken) }); + public async Task GetByUserId(long userId) + => Ok(await mediator.Send(new GetProjectManagerByUserIdQuery(userId))); [HttpGet("get-all")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAll(CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllProjectManagersQuery(), cancellationToken) }); + public async Task GetAll() + => Ok(await mediator.Send(new GetAllProjectManagersQuery())); } diff --git a/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs b/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs index dbda797..0b59ae0 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentationAppsController.cs @@ -1,6 +1,7 @@ using EcoLink.Domain.Entities.Representation; -using EcoLink.Application.RepresentationApps.Queries.GetRepresentationApp; +using EcoLink.Application.Representatives.Queries.GetRepresentatives; using EcoLink.Application.RepresentationApps.Commands.CreateRepresentationApps; +using EcoLink.Application.RepresentationApps.Queries.GetRepresentationApp; namespace EcoLink.WebApi.Controllers.Representative; @@ -8,16 +9,16 @@ public class RepresentationAppsController(IMediator mediator) : BaseController { [HttpPost("create-with-return")] [ProducesResponseType(typeof(RepresentationApp), StatusCodes.Status200OK)] - public async Task Create(CreateRepresentationAppWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateRepresentationAppWithReturnCommand(command), cancellationToken) }); + public async Task Create(CreateRepresentationAppWithReturnCommand command) + => Ok(await mediator.Send(new CreateRepresentationAppWithReturnCommand(command))); [HttpGet("get/{id:long}")] [ProducesResponseType(typeof(RepresentationApp), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetRepresentationAppByIdQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetRepresentationAppByIdQuery(id))); [HttpGet("get-all-by-user-id/{userId:long}")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAllByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetRepresentationAppByIdQuery(userId), cancellationToken) }); + public async Task GetAllByUserId(long userId) + => Ok(await mediator.Send(new GetRepresentationAppByIdQuery(userId))); } diff --git a/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentativeController.cs b/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentativeController.cs index 37f3103..875d9ba 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentativeController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Representative/RepresentativeController.cs @@ -10,35 +10,35 @@ public class RepresentativesController(IMediator mediator) : BaseController { [HttpPost("create")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Create(CreateRepresentativeCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateRepresentativeCommand(command), cancellationToken) }); + public async Task Create(CreateRepresentativeCommand command) + => Ok(await mediator.Send(new CreateRepresentativeCommand(command))); [HttpPost("create-with-return")] [ProducesResponseType(type: typeof(RepresentativeResultDto), StatusCodes.Status200OK)] - public async Task CreateWithReturn(CreateRepresentativeWithReturnCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new CreateRepresentativeWithReturnCommand(command), cancellationToken) }); + public async Task CreateWithReturn(CreateRepresentativeWithReturnCommand command) + => Ok(await mediator.Send(new CreateRepresentativeWithReturnCommand(command))); [HttpPut("update")] [ProducesResponseType(typeof(RepresentativeResultDto), StatusCodes.Status200OK)] - public async Task Update(UpdateRepresentativeCommand command, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new UpdateRepresentativeCommand(command), cancellationToken) }); + public async Task Update(UpdateRepresentativeCommand command) + => Ok(await mediator.Send(new UpdateRepresentativeCommand(command))); [HttpDelete("delete/{id:long}")] - public async Task Delete(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new DeleteRepresentativeCommand(id), cancellationToken) }); + public async Task Delete(long id) + => Ok(await mediator.Send(new DeleteRepresentativeCommand(id))); [HttpGet("get/{id:long}")] [ProducesResponseType(typeof(RepresentativeResultDto), StatusCodes.Status200OK)] - public async Task Get(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetRepresentativeQuery(id), cancellationToken) }); + public async Task Get(long id) + => Ok(await mediator.Send(new GetRepresentativeQuery(id))); [HttpGet("get-by-user-id/{userId:long}")] [ProducesResponseType(typeof(RepresentativeResultDto), StatusCodes.Status200OK)] - public async Task GetByUserId(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetRepresentativeByUserIdQuery(userId), cancellationToken) }); + public async Task GetByUserId(long userId) + => Ok(await mediator.Send(new GetRepresentativeByUserIdQuery(userId))); [HttpGet("get-all")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAll(CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllRepresentativesQuery(), cancellationToken) }); + public async Task GetAll() + => Ok(await mediator.Send(new GetAllRepresentativesQuery())); } diff --git a/src/backend/EcoLink.WebApi/Controllers/Users/UsersController.cs b/src/backend/EcoLink.WebApi/Controllers/Users/UsersController.cs index 2503963..4773e34 100644 --- a/src/backend/EcoLink.WebApi/Controllers/Users/UsersController.cs +++ b/src/backend/EcoLink.WebApi/Controllers/Users/UsersController.cs @@ -10,36 +10,36 @@ public class UsersController(IMediator mediator) : BaseController { [HttpPost("create")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Create(CreateUserCommand command, CancellationToken cancellationToken) - => Ok(new Response { Data = await mediator.Send(new CreateUserCommand(command), cancellationToken) }); + public async Task Create(CreateUserCommand command) + => Ok(await mediator.Send(new CreateUserCommand(command))); [HttpPost("create-with-return")] [ProducesResponseType(typeof(UserResultDto), StatusCodes.Status200OK)] - public async Task Create(CreateUserWithReturnCommand command, CancellationToken cancellationToken) - => Ok(new Response { Data = await mediator.Send(new CreateUserWithReturnCommand(command), cancellationToken) }); + public async Task Create(CreateUserWithReturnCommand command) + => Ok(await mediator.Send(new CreateUserWithReturnCommand(command))); [HttpPut("update")] [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - public async Task Update(UpdateUserCommand command, CancellationToken cancellationToken) - => Ok(new Response { Data = await mediator.Send(new UpdateUserCommand(command), cancellationToken) }); + public async Task Update(UpdateUserCommand command) + => Ok(await mediator.Send(new UpdateUserCommand(command))); [HttpDelete("delete/{id:long}")] [ProducesResponseType(typeof(bool), StatusCodes.Status200OK)] - public async Task Delete(long id, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new DeleteUserCommand(id), cancellationToken) }); + public async Task Delete(long id) + => Ok(await mediator.Send(new DeleteUserCommand(id))); [HttpGet("get/{userId:long}")] [ProducesResponseType(typeof(UserResultDto), StatusCodes.Status200OK)] - public async Task Get(long userId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetUserQuery(userId), cancellationToken) }); + public async Task Get(long userId) + => Ok(await mediator.Send(new GetUserQuery(userId))); [HttpGet("get-by-telegram-id/{telegramId:long}")] [ProducesResponseType(typeof(UserResultDto), StatusCodes.Status200OK)] - public async Task GetByTelegramId(long telegramId, CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetUserByTelegramIdQuery(telegramId), cancellationToken) }); + public async Task GetByTelegramId(long telegramId) + => Ok(await mediator.Send(new GetUserByTelegramIdQuery(telegramId))); [HttpGet("get-all")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetForApplication(CancellationToken cancellationToken = default) - => Ok(new Response { Data = await mediator.Send(new GetAllUsersQuery(), cancellationToken) }); + public async Task GetForApplication() + => Ok(await mediator.Send(new GetAllUsersQuery())); } diff --git a/src/backend/EcoLink.WebApi/EcoLink.WebApi.csproj b/src/backend/EcoLink.WebApi/EcoLink.WebApi.csproj index 541db82..005a9f3 100644 --- a/src/backend/EcoLink.WebApi/EcoLink.WebApi.csproj +++ b/src/backend/EcoLink.WebApi/EcoLink.WebApi.csproj @@ -1,4 +1,4 @@ - + net8.0 diff --git a/src/backend/EcoLink.WebApi/GlobalUsing.cs b/src/backend/EcoLink.WebApi/GlobalUsing.cs deleted file mode 100644 index 16a09d1..0000000 --- a/src/backend/EcoLink.WebApi/GlobalUsing.cs +++ /dev/null @@ -1 +0,0 @@ -global using EcoLink.WebApi.Models; \ No newline at end of file diff --git a/src/backend/EcoLink.WebApi/Models/Response.cs b/src/backend/EcoLink.WebApi/Models/Response.cs deleted file mode 100644 index 8bc3d63..0000000 --- a/src/backend/EcoLink.WebApi/Models/Response.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace EcoLink.WebApi.Models; - -public class Response -{ - public int Status { get; set; } = 200; - public string Message { get; set; } = "Success"; - public object Data { get; set; } = default!; -} diff --git a/src/backend/EcoLink.WebApi/Program.cs b/src/backend/EcoLink.WebApi/Program.cs index 28713dd..f0eb330 100644 --- a/src/backend/EcoLink.WebApi/Program.cs +++ b/src/backend/EcoLink.WebApi/Program.cs @@ -18,6 +18,12 @@ builder.Services.AddInfrastructureServices(builder.Configuration); builder.Services.AddApplicationServices(); + +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo { Title = "EcoLink", Version = "v1" }); +}); + // Build var app = builder.Build(); @@ -28,10 +34,12 @@ if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + }); } - app.UseHttpsRedirection(); app.UseAuthorization(); diff --git a/src/frontend/EcoLink.ApiService/Constants/TimeConstats.cs b/src/frontend/EcoLink.ApiService/Constants/TimeConstats.cs deleted file mode 100644 index 67608a6..0000000 --- a/src/frontend/EcoLink.ApiService/Constants/TimeConstats.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace EcoLink.ApiService.Constants; - -public class TimeConstants -{ - // This is for uzbek time - public const double UTC = 5; -} diff --git a/src/frontend/EcoLink.ApiService/DependencyInjection.cs b/src/frontend/EcoLink.ApiService/DependencyInjection.cs deleted file mode 100644 index 34adf0a..0000000 --- a/src/frontend/EcoLink.ApiService/DependencyInjection.cs +++ /dev/null @@ -1,19 +0,0 @@ -using EcoLink.ApiService.Constants; -using EcoLink.ApiService.Services; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace EcoLink.ApiService; - -public static class DependencyInjection -{ - public static IServiceCollection AddApiServices(this IServiceCollection services, IConfiguration configuration) - { - services.AddHttpClient(client => - { - client.BaseAddress = new Uri($"{configuration["BaseUrl"]}api/Users/"); - }); - - return services; - } -} diff --git a/src/frontend/EcoLink.ApiService/EcoLink.ApiService.csproj b/src/frontend/EcoLink.ApiService/EcoLink.ApiService.csproj index 9790504..d230e96 100644 --- a/src/frontend/EcoLink.ApiService/EcoLink.ApiService.csproj +++ b/src/frontend/EcoLink.ApiService/EcoLink.ApiService.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/frontend/EcoLink.ApiService/GlobalUsing.cs b/src/frontend/EcoLink.ApiService/GlobalUsing.cs index fb8867c..3759efd 100644 --- a/src/frontend/EcoLink.ApiService/GlobalUsing.cs +++ b/src/frontend/EcoLink.ApiService/GlobalUsing.cs @@ -1,7 +1 @@ -global using System.Text; -global using System.Text.Json; -global using EcoLink.Domain.Enums; -global using System.Net.Http.Json; -global using EcoLink.ApiService.Helpers; -global using EcoLink.ApiService.Interfaces; -global using EcoLink.ApiService.Models.Commons; \ No newline at end of file +global using EcoLink.Domain.Enums; \ No newline at end of file diff --git a/src/frontend/EcoLink.ApiService/Helpers/ConvertHelper.cs b/src/frontend/EcoLink.ApiService/Helpers/ConvertHelper.cs index 3752c80..f1bd153 100644 --- a/src/frontend/EcoLink.ApiService/Helpers/ConvertHelper.cs +++ b/src/frontend/EcoLink.ApiService/Helpers/ConvertHelper.cs @@ -1,29 +1,27 @@ -namespace EcoLink.ApiService.Helpers; +namespace MedX.ApiService.Helpers; public class ConvertHelper { - public static StringContent ConvertToStringContent(T dto) where T : class - => new (JsonSerializer.Serialize(dto), Encoding.UTF8, "application/json"); + public static MultipartFormDataContent ConvertToMultipartFormContent(T dto) + { + var properties = typeof(T).GetProperties(); + var multipartFormContent = new MultipartFormDataContent(); - //public static MultipartFormDataContent ConvertToMultipartFormContent(T dto) - //{ - // var properties = typeof(T).GetProperties(); - // var multipartFormContent = new MultipartFormDataContent(); + foreach (var property in properties) + { + var value = property.GetValue(dto); + if (value != null) + if (property.PropertyType == typeof(IFormFile)) + { + var formFile = (IFormFile)value; + StreamContent streamContent = new(formFile.OpenReadStream()); + multipartFormContent.Add(streamContent, property.Name, formFile.FileName); + } + else + multipartFormContent.Add(new StringContent(value.ToString()!), property.Name); + } - // foreach (var property in properties) - // { - // var value = property.GetValue(dto); - // if (value != null) - // if (property.PropertyType == typeof(IFormFile)) - // { - // var formFile = (IFormFile)value; - // StreamContent streamContent = new(formFile.OpenReadStream()); - // multipartFormContent.Add(streamContent, property.Name, formFile.FileName); - // } - // else - // multipartFormContent.Add(new StringContent(value.ToString()!), property.Name); - // } + return multipartFormContent; + } - // return multipartFormContent; - //} } diff --git a/src/frontend/EcoLink.ApiService/Interfaces/IUserService.cs b/src/frontend/EcoLink.ApiService/Interfaces/IUserService.cs index 9094966..c875754 100644 --- a/src/frontend/EcoLink.ApiService/Interfaces/IUserService.cs +++ b/src/frontend/EcoLink.ApiService/Interfaces/IUserService.cs @@ -4,9 +4,9 @@ namespace EcoLink.ApiService.Interfaces; public interface IUserService { - Task> AddAsync(UserDto dto, CancellationToken cancellationToken); - Task> UpdateAsync(UserDto dto, CancellationToken cancellationToken); - Task> DeleteAsync(long id, CancellationToken cancellationToken); - Task> GetAsync(long id, CancellationToken cancellationToken); - Task>> GetAllAsync(CancellationToken cancellationToken); + Task> AddAsync(EmployeeCreationDto dto); + Task> UpdateAsync(EmployeeUpdateDto dto); + Task> DeleteAsync(long id); + Task> GetAsync(long id); + Task>> GetAllAsync(PaginationParams @params, string search = null!); } diff --git a/src/frontend/EcoLink.ApiService/Models/Commons/Response.cs b/src/frontend/EcoLink.ApiService/Models/Commons/Response.cs deleted file mode 100644 index 1a8aec3..0000000 --- a/src/frontend/EcoLink.ApiService/Models/Commons/Response.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace EcoLink.ApiService.Models.Commons; - -public class Response -{ - public int Status { get; set; } - public string Message { get; set; } = string.Empty; - public T Data { get; set; } = default!; -} diff --git a/src/frontend/EcoLink.ApiService/Models/Entrepreneurship/Entrepreneur.cs b/src/frontend/EcoLink.ApiService/Models/Entrepreneurship/Entrepreneur.cs deleted file mode 100644 index f9f1ea5..0000000 --- a/src/frontend/EcoLink.ApiService/Models/Entrepreneurship/Entrepreneur.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace EcoLink.ApiService.Models.Entrepreneurs; - -public class Entrepreneur -{ - public string Project { get; set; } = string.Empty; - public string HelpType { get; set; } = string.Empty; - public string RequiredFunding { get; set; } = string.Empty; - public string AssetsInvested { get; set; } = string.Empty; - public bool IsSubmitted { get; set; } -} diff --git a/src/frontend/EcoLink.ApiService/Models/Investment/Investor.cs b/src/frontend/EcoLink.ApiService/Models/Investment/Investor.cs deleted file mode 100644 index cbc13d9..0000000 --- a/src/frontend/EcoLink.ApiService/Models/Investment/Investor.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace EcoLink.ApiService.Models.Investors; - -public class Investor -{ - public string Sector { get; set; } = string.Empty; - public string InvestmentAmount { get; set; } = string.Empty; - public bool IsSubmitted { get; set; } -} diff --git a/src/frontend/EcoLink.ApiService/Models/ProjectManagement/ProjectManager.cs b/src/frontend/EcoLink.ApiService/Models/ProjectManagement/ProjectManager.cs deleted file mode 100644 index de31869..0000000 --- a/src/frontend/EcoLink.ApiService/Models/ProjectManagement/ProjectManager.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace EcoLink.ApiService.Models.ProjectManagers; - -public class ProjectManager -{ - public string ProjectDirection { get; set; } = string.Empty; - public string Expectation { get; set; } = string.Empty; - public string Purpose { get; set; } = string.Empty; - public bool IsSubmitted { get; set; } -} diff --git a/src/frontend/EcoLink.ApiService/Models/Representation/Representative.cs b/src/frontend/EcoLink.ApiService/Models/Representation/Representative.cs deleted file mode 100644 index a1645e4..0000000 --- a/src/frontend/EcoLink.ApiService/Models/Representation/Representative.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace EcoLink.ApiService.Models.Representatives; - -public class Representative -{ - public string Area { get; set; } = string.Empty; - public string Expectation { get; set; } = string.Empty; - public string Purpose { get; set; } = string.Empty; - public bool IsSubmitted { get; set; } -} diff --git a/src/frontend/EcoLink.ApiService/Models/Users/UserDto.cs b/src/frontend/EcoLink.ApiService/Models/Users/UserDto.cs index 1ae4db4..fe9d004 100644 --- a/src/frontend/EcoLink.ApiService/Models/Users/UserDto.cs +++ b/src/frontend/EcoLink.ApiService/Models/Users/UserDto.cs @@ -15,9 +15,8 @@ public class UserDto public string Languages { get; set; } = string.Empty; public string Experience { get; set; } = string.Empty; public UserProfession Profession { get; set; } - public State State { get; set; } public long TelegramId { get; set; } - public string Username { get; set; } = string.Empty; + public string UserName { get; set; } = string.Empty; public string LanguageCode { get; set; } = string.Empty; public long ChatId { get; set; } public bool IsBot { get; set; } diff --git a/src/frontend/EcoLink.ApiService/Services/EmployeeService.cs b/src/frontend/EcoLink.ApiService/Services/EmployeeService.cs new file mode 100644 index 0000000..6dbd256 --- /dev/null +++ b/src/frontend/EcoLink.ApiService/Services/EmployeeService.cs @@ -0,0 +1,62 @@ +using MedX.ApiService.Models.Employees; + +namespace MedX.ApiService.Services; + +public class EmployeeService(HttpClient client) : IEmployeeService +{ + public async Task> AddAsync(EmployeeCreationDto dto) + { + using var multipartFormContent = ConvertHelper.ConvertToMultipartFormContent(dto); + using var response = await client.PostAsync("create", multipartFormContent); + if (!response.IsSuccessStatusCode) + return default!; + + return (await response.Content.ReadFromJsonAsync>())!; + } + + public async Task> UpdateAsync(EmployeeUpdateDto dto) + { + using var multipartFormContent = ConvertHelper.ConvertToMultipartFormContent(dto); + using var response = await client.PutAsync("update", multipartFormContent); + if (!response.IsSuccessStatusCode) + return default!; + + return (await response.Content.ReadFromJsonAsync>())!; + } + + public async Task> DeleteAsync(long id) + { + using var response = await client.DeleteAsync($"delete/{id}"); + if (!response.IsSuccessStatusCode) + return default!; + + return (await response.Content.ReadFromJsonAsync>())!; + } + + public async Task> GetAsync(long id) + { + using var response = await client.GetAsync($"get/{id}"); + if (!response.IsSuccessStatusCode) + return default!; + + return (await response.Content.ReadFromJsonAsync>())!; + } + + public async Task>> GetAllAsync(PaginationParams @params, string search = null!) + { + var queryParams = new Dictionary + { + { nameof(@params.PageIndex), @params.PageIndex.ToString() }, + { nameof(@params.PageSize), @params.PageSize.ToString() }, + { nameof(search), search } + }; + + var queryString = string.Join("&", queryParams.Where(p => !string.IsNullOrEmpty(p.Value)).Select(p => $"{p.Key}={p.Value}")); + using var response = await client.GetAsync($"get-all?{queryString}"); + + if (!response.IsSuccessStatusCode) + return default!; + + return (await response.Content.ReadFromJsonAsync>>())!; + } +} \ No newline at end of file diff --git a/src/frontend/EcoLink.ApiService/Services/UserService.cs b/src/frontend/EcoLink.ApiService/Services/UserService.cs deleted file mode 100644 index a13f1d6..0000000 --- a/src/frontend/EcoLink.ApiService/Services/UserService.cs +++ /dev/null @@ -1,82 +0,0 @@ -using EcoLink.ApiService.Models.Users; - -namespace EcoLink.ApiService.Services; - -public class UserService(HttpClient client) : IUserService -{ - public async Task> AddAsync(UserDto dto, CancellationToken cancellationToken) - { - using var content = ConvertHelper.ConvertToStringContent(dto); - using var response = await client.PostAsync(requestUri: "create-with-return", - content: content, - cancellationToken: cancellationToken); - - if (!response.IsSuccessStatusCode) - return default!; - - return (await response.Content.ReadFromJsonAsync>(cancellationToken: cancellationToken))!; - } - - public async Task> UpdateAsync(UserDto dto, CancellationToken cancellationToken) - { - using var content = ConvertHelper.ConvertToStringContent(dto); - using var response = await client.PutAsync(requestUri: "update", - content: content, - cancellationToken: cancellationToken); - - if (!response.IsSuccessStatusCode) - return default!; - - return (await response.Content.ReadFromJsonAsync>(cancellationToken: cancellationToken))!; - } - - public async Task> DeleteAsync(long id, CancellationToken cancellationToken) - { - using var response = await client.DeleteAsync(requestUri: $"delete/{id}", cancellationToken: cancellationToken); - - if (!response.IsSuccessStatusCode) - return default!; - - return (await response.Content.ReadFromJsonAsync>(cancellationToken: cancellationToken))!; - } - - public async Task> GetAsync(long id, CancellationToken cancellationToken) - { - using var response = await client.GetAsync(requestUri: $"get/{id}", cancellationToken: cancellationToken); - - if (!response.IsSuccessStatusCode) - return default!; - - return (await response.Content.ReadFromJsonAsync>(cancellationToken: cancellationToken))!; - } - - public async Task> GetByTelegramIdAsync(long telegramId, CancellationToken cancellationToken) - { - using var response = await client.GetAsync(requestUri: $"get-by-telegram-id/{telegramId}", cancellationToken: cancellationToken); - - if (!response.IsSuccessStatusCode) - return default!; - - return (await response.Content.ReadFromJsonAsync>(cancellationToken: cancellationToken))!; - } - - public async Task>>GetAllAsync(CancellationToken cancellationToken) - { - #region Pagination - //var queryParams = new Dictionary - //{ - // { nameof(@params.PageIndex), @params.PageIndex.ToString() }, - // { nameof(@params.PageSize), @params.PageSize.ToString() }, - // { nameof(search), search } - //}; - //var queryString = string.Join("&", queryParams.Where(p => !string.IsNullOrEmpty(p.Value)).Select(p => $"{p.Key}={p.Value}")); - #endregion - - using var response = await client.GetAsync(requestUri: $"get-all", cancellationToken: cancellationToken); - - if (!response.IsSuccessStatusCode) - return default!; - - return (await response.Content.ReadFromJsonAsync>>(cancellationToken: cancellationToken))!; - } -} \ No newline at end of file diff --git a/src/frontend/EcoLink.Bot/BotServices/Commons/BotUpdateHandler.cs b/src/frontend/EcoLink.Bot/BotServices/Commons/BotUpdateHandler.cs index 702a138..1864497 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Commons/BotUpdateHandler.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Commons/BotUpdateHandler.cs @@ -2,27 +2,27 @@ using Telegram.Bot.Polling; using EcoLink.Bot.Resources; using Telegram.Bot.Types.Enums; -using EcoLink.ApiService.Interfaces; -using EcoLink.ApiService.Models.Users; +using EcoLink.Application.Users.DTOs; using Microsoft.Extensions.Localization; +using EcoLink.Application.Users.Commands.CreateUsers; namespace EcoLink.Bot.BotServices; public partial class BotUpdateHandler( ILogger logger, IServiceScopeFactory serviceScopeFactory, - IUserService service) : IUpdateHandler + IMediator mediator) : IUpdateHandler { private IStringLocalizer localizer = default!; - private UserDto user = default!; + private UserTelegramResultDto user = default!; public async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken) { using var scope = serviceScopeFactory.CreateScope(); - //mediator = scope.ServiceProvider.GetRequiredService(); + mediator = scope.ServiceProvider.GetRequiredService(); localizer = scope.ServiceProvider.GetRequiredService>(); - user = await GetUserAsync(update, cancellationToken); + user = await GetUserAsync(update); var culture = user.LanguageCode switch { "uz" => new CultureInfo("uz-Uz"), @@ -42,16 +42,20 @@ public async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, }; try { await handler; } - catch(Exception ex) { await HandlePollingErrorAsync(botClient, ex, cancellationToken); } + catch(Exception ex) + { + logger.LogError("HandlePollingError: {ErrorText}", ex.Message); + await HandlePollingErrorAsync(botClient, ex, cancellationToken); + } } - private async Task GetUserAsync(Update update, CancellationToken cancellationToken) + private async Task GetUserAsync(Update update) { var updateContent = BotUpdateHandler.GetUpdateType(update); var from = updateContent.From; - return await service.GetAsync(id: from.Id, cancellationToken: cancellationToken) - ?? await service.AddAsync(dto: new UserDto + return await mediator.Send(new GetUserByTelegramIdQuery(from.Id)) + ?? await mediator.Send(new CreateUserWithReturnCommand() { IsBot = from.IsBot, TelegramId = from.Id, @@ -60,7 +64,7 @@ private async Task GetUserAsync(Update update, CancellationToken cancel FirstName = from.FirstName, ChatId = update.Message!.Chat.Id, LanguageCode = from.LanguageCode - }, cancellationToken: cancellationToken); + }); } private static dynamic GetUpdateType(Update update) @@ -82,8 +86,7 @@ private static dynamic GetUpdateType(Update update) public Task HandlePollingErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken) { - logger.LogError("HandlePollingError: {ErrorText}", exception.Message); - return Task.CompletedTask; + throw new NotImplementedException(); } private Task HandleUnknownUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken) diff --git a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.Application.cs b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.Application.cs index 8d63619..9a1cf28 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.Application.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.Application.cs @@ -1,4 +1,8 @@ -namespace EcoLink.Bot.BotServices; +using EcoLink.Application.Investors.Commands.UpdateInvestors; +using EcoLink.Application.Entrepreneurs.Commands.UpdateEntrepreneurs; +using EcoLink.Application.ProjectManagers.Commands.UpdateProjectManagers; + +namespace EcoLink.Bot.BotServices; public partial class BotUpdateHandler { @@ -24,6 +28,7 @@ private async Task HandleCancelApplication(ITelegramBotClient botClient, Callbac ArgumentNullException.ThrowIfNull(callbackQuery); ArgumentNullException.ThrowIfNull(callbackQuery.Message); + await botClient.EditMessageTextAsync( chatId: callbackQuery.Message.Chat.Id, messageId: callbackQuery.Message.MessageId, @@ -59,10 +64,11 @@ await botClient.EditMessageTextAsync( text: localizer["txtSelected", sector], cancellationToken: cancellationToken); - switch (user.Profession) + var profession = await mediator.Send(new GetProfessionQuery(user.Id), cancellationToken); + switch (profession) { case UserProfession.Investor: - user.Application.Sector = sector; + await mediator.Send(new UpdateInvestorSectorByUserIdCommand { UserId = user.Id, Sector = sector }, cancellationToken); await SendRequestForInvestmentAmountForInvestmentAsync(botClient, callbackQuery.Message, cancellationToken); break; case UserProfession.ProjectManager: diff --git a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.cs b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.cs index e83bf3a..ac69383 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.CallbackQuery.cs @@ -1,6 +1,4 @@ -using System.Globalization; - -namespace EcoLink.Bot.BotServices; +namespace EcoLink.Bot.BotServices; public partial class BotUpdateHandler { @@ -8,7 +6,8 @@ private async Task HandleCallbackQuery(ITelegramBotClient botClient, CallbackQue { ArgumentNullException.ThrowIfNull(callbackQuery); - var handler = user.State switch + var state = await mediator.Send(new GetStateQuery(user.Id), cancellationToken); + var handler = state switch { State.WaitingForSelectLanguage => HandleSelectedLanguageAsync(botClient, callbackQuery, cancellationToken), State.WaitingForEnterSector => HandleSectorAsync(botClient, callbackQuery, cancellationToken), @@ -32,27 +31,26 @@ private async Task HandleSelectedLanguageAsync(ITelegramBotClient botClient, Cal ArgumentNullException.ThrowIfNull(callbackQuery.Data); ArgumentNullException.ThrowIfNull(callbackQuery.Message); - user.LanguageCode = callbackQuery.Data switch - { - "ibtnEn" => "en", - "ibtnRu" => "ru", - _ => "uz" - }; - - var culture = user.LanguageCode switch + string text; + switch (callbackQuery.Data) { - "uz" => new CultureInfo("uz-Uz"), - "en" => new CultureInfo("en-US"), - "ru" => new CultureInfo("ru-RU"), - _ => CultureInfo.CurrentCulture - }; - - CultureInfo.CurrentCulture = new CultureInfo("uz-Uz"); - CultureInfo.CurrentUICulture = new CultureInfo("uz-Uz"); + case "ibtnEn": + await mediator.Send(new UpdateLanguageCodeCommand { Id = user.Id, LanguageCode = "en" }, cancellationToken); + text = "Great, we will continue with you in English!"; + break; + case "ibtnRu": + await mediator.Send(new UpdateLanguageCodeCommand { Id = user.Id, LanguageCode = "ru" }, cancellationToken); + text = "Отлично, мы продолжим с вами на русском языке!"; + break; + default: + await mediator.Send(new UpdateLanguageCodeCommand { Id = user.Id, LanguageCode = "uz" }, cancellationToken); + text = "Ajoyib, siz bilan o'zbek tilida davom ettiramiz!"; + break; + } await botClient.EditMessageTextAsync( chatId: callbackQuery.Message.Chat.Id, - text: localizer["txtLanguageSelected"], + text: text, messageId: callbackQuery.Message.MessageId, cancellationToken: cancellationToken); diff --git a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.Application.Helper.cs b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.Application.Helper.cs index 36da537..d27a01b 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.Application.Helper.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.Application.Helper.cs @@ -1,8 +1,13 @@ -namespace EcoLink.Bot.BotServices; +using EcoLink.Application.Investors.DTOs; +using EcoLink.Application.Entrepreneurs.DTOs; +using EcoLink.Application.ProjectManagers.DTOs; +using EcoLink.Application.Representatives.DTOs; + +namespace EcoLink.Bot.BotServices; public partial class BotUpdateHandler { - public static string GetApplicationInfoForm(Entrepreneur dto) + public static string GetApplicationInfoForm(EntrepreneurResultDto dto) => $"Ism: {dto.User.FirstName}\n" + $"Familiya: {dto.User.LastName}\n" + $"Yoshi: {dto.User.Age}\n" + @@ -15,7 +20,7 @@ public static string GetApplicationInfoForm(Entrepreneur dto) $"Telefon raqami: {dto.User.Phone}\n" + $"Email: {dto.User.Email}"; - public static string GetApplicationInfoForm(Investor dto) + public static string GetApplicationInfoForm(InvestorResultDto dto) => $"Ism: {dto.User.FirstName}\n" + $"Familiya: {dto.User.LastName}\n" + $"Yoshi: {dto.User.Age}\n" + @@ -26,7 +31,7 @@ public static string GetApplicationInfoForm(Investor dto) $"Telefon raqami: {dto.User.Phone}\n" + $"Email: {dto.User.Email}"; - public static string GetApplicationInfoForm(Representative dto) + public static string GetApplicationInfoForm(RepresentativeResultDto dto) => $"Ism: {dto.User.FirstName}\n" + $"Familiya: {dto.User.LastName}\n" + $"Yoshi: {dto.User.Age}\n" + @@ -38,7 +43,7 @@ public static string GetApplicationInfoForm(Representative dto) $"Tikilgan aktiv: {dto.Expectation}\n" + $"Telefon raqami: {dto.Purpose}\n"; - public static string GetApplicationInfoForm(ProjectManager dto) + public static string GetApplicationInfoForm(ProjectManagerResultDto dto) => $"Ism: {dto.User.FirstName}\n" + $"Familiya: {dto.User.LastName}\n" + $"Yoshi: {dto.User.Age}\n" + diff --git a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.cs b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.cs index f5788e8..8a55e7c 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Handlers/BotUpdateHandler.Message.Text.cs @@ -24,7 +24,7 @@ private async Task HandleTextMessageAsync(ITelegramBotClient botClient, Message State.WaitingForSelectRepresentationMenu => HandleSelectedRepresentationMenuAsync(botClient, message, cancellationToken), State.WaitingForFeedbackForOrganization => HandleFeedbackForOrganizationAsync(botClient, message, cancellationToken), State.WaitingForFeedbackForTelegramBot => HandleFeedbackForTelegramBotAsync(botClient, message, cancellationToken), - State.WaitingForSelectForEditPersonalInfo => HandleSelectedPersonalInfoAsync(botClient, message, cancellationToken), + State.WaitingForSelectPersonalInfo => HandleSelectedPersonalInfoAsync(botClient, message, cancellationToken), State.WaitingForSubmitApplication => SendGreetingAsync(botClient, message, cancellationToken), State.WaitingForResendApplication => HandleResendApplicationAsync(botClient, message, cancellationToken), State.WaitingForEnterFirstName => HandleFirstNameAsync(botClient, message, cancellationToken), diff --git a/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendApplication.cs b/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendApplication.cs index ddf0b5a..1c24899 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendApplication.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendApplication.cs @@ -1,4 +1,8 @@ -using EcoLink.ApiService.Constants; +using EcoLink.Application.Commons.Constants; +using EcoLink.Application.Investors.Queries.GetInvestors; +using EcoLink.Application.Entrepreneurs.Queries.GetEntrepreneurs; +using EcoLink.Application.ProjectManagers.Queries.GetProjectManagers; +using EcoLink.Application.Representatives.Queries.GetRepresentatives; namespace EcoLink.Bot.BotServices; @@ -38,36 +42,37 @@ await botClient.SendTextMessageAsync( private async Task SendForSubmitApplicationAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var sending = await botClient.SendTextMessageAsync( + var profession = await mediator.Send(new GetProfessionQuery(user.Id), cancellationToken); + var applicationText = profession switch + { + UserProfession.ProjectManager => GetApplicationInfoForm(await mediator.Send(new GetProjectManagerByUserIdQuery(user.Id), cancellationToken)), + UserProfession.Investor => GetApplicationInfoForm(await mediator.Send(new GetInvestorByUserIdQuery(user.Id), cancellationToken)), + UserProfession.Entrepreneur => GetApplicationInfoForm(await mediator.Send(new GetEntrepreneurByUserIdQuery(user.Id), cancellationToken)), + UserProfession.Representative => GetApplicationInfoForm(await mediator.Send(new GetRepresentativeByUserIdQuery(user.Id), cancellationToken)), + _ => string.Empty, + }; + + await botClient.SendTextMessageAsync( chatId: message.Chat.Id, text: localizer["txtReadyApplication"], replyMarkup: new ReplyKeyboardRemove(), cancellationToken: cancellationToken ); - user.Application = user.Profession switch - { - UserProfession.ProjectManager => GetApplicationInfoForm(user.Application), - UserProfession.Investor => GetApplicationInfoForm(user.Application), - UserProfession.Entrepreneur => GetApplicationInfoForm(user.Application), - UserProfession.Representative => GetApplicationInfoForm(user.Application), - _ => string.Empty, - }; - + await Task.Delay(1000, cancellationToken); var keyboard = new InlineKeyboardMarkup(new InlineKeyboardButton[][] { [InlineKeyboardButton.WithCallbackData(localizer["ibtnSubmit"], "submit")], [InlineKeyboardButton.WithCallbackData(localizer["ibtnCancel"], "cancel")] }); - await botClient.EditMessageTextAsync( - messageId: sending.MessageId, + await botClient.SendTextMessageAsync( chatId: message.Chat.Id, text: applicationText, replyMarkup: keyboard, cancellationToken: cancellationToken ); - user.State = State.WaitingForSubmitApplication; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSubmitApplication), cancellationToken); } private async Task SendRequestForFirstNameAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -85,7 +90,7 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForEnterFirstName; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterFirstName), cancellationToken); } private async Task SendRequestForLastNameAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -103,15 +108,16 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForEnterLastName; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterLastName), cancellationToken); } private async Task SendRequestForPatronomycAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Patronomyc) switch + var exist = await mediator.Send(new GetUserQuery() { Id = user.Id }, cancellationToken); + var args = string.IsNullOrEmpty(exist.Patronomyc) switch { true => (localizer["txtAskForPatronomyc"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForPatronomyc"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Patronomyc)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) + false => (localizer["txtAskForPatronomyc"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(exist.Patronomyc)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -120,15 +126,16 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterPatronomyc; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterPatronomyc), cancellationToken); } private async Task SendRequestForAgeAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Age) switch + var age = await mediator.Send(new GetAgeQuery(user.Id), cancellationToken); + var args = string.IsNullOrEmpty(age) switch { true => (localizer["txtAskForAge"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForAge"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Age)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) + false => (localizer["txtAskForAge"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(age)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -137,15 +144,16 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterAge; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterAge), cancellationToken); } private async Task SendRequestForDateOfBirthAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var formattedDate = user.DateOfBirth.ToString("dd.MM.yyyy"); + var dateOfBirth = await mediator.Send(new GetDateOfBirthQuery(user.Id), cancellationToken); + var formattedDate = dateOfBirth.ToString("dd.MM.yyyy"); var @default = DateTimeOffset.MinValue.AddHours(TimeConstants.UTC); - var args = (user.DateOfBirth == @default) switch + var args = (dateOfBirth == @default) switch { true => (localizer["txtAskForDateOfBirth"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), false => (localizer["txtAskForDateOfBirth"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(formattedDate)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) @@ -157,7 +165,7 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterDateOfBirth; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterDateOfBirth), cancellationToken); } private async Task SendRequestForDegreeAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -177,15 +185,16 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForEnterDegree; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterDegree), cancellationToken); } private async Task SendRequestForLanguagesAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Languages) switch + var languages = await mediator.Send(new GetLanguagesQuery(user.Id), cancellationToken); + var args = string.IsNullOrEmpty(languages) switch { true => (localizer["txtAskForSkillLanguages"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForSkillLanguages"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Languages)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) + false => (localizer["txtAskForSkillLanguages"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(languages)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -195,7 +204,7 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForEnterLanguages; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterLanguages), cancellationToken); } private async Task SendRequestForPhoneNumberAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -213,15 +222,16 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForEnterPhoneNumber; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterPhoneNumber), cancellationToken); } private async Task SendRequestForEmailAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Email) switch + var email = await mediator.Send(new GetEmailQuery(user.Id), cancellationToken); + var args = string.IsNullOrEmpty(email) switch { true => (localizer["txtAskForEmail"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForEmail"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Email)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) + false => (localizer["txtAskForEmail"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(email)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -230,15 +240,16 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterEmail; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterEmail), cancellationToken); } private async Task SendRequestForExperienceAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Experience) switch + var experience = await mediator.Send(new GetExperienceQuery(user.Id), cancellationToken); + var args = string.IsNullOrEmpty(experience) switch { true => (localizer["txtAskForExperience"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForExperience"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Experience)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) + false => (localizer["txtAskForExperience"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(experience)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -247,15 +258,16 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterExperience; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterExperience), cancellationToken); } private async Task SendRequestForAddressAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Address) switch + var address = await mediator.Send(new GetAddressQuery(user.Id), cancellationToken); + var args = string.IsNullOrEmpty(address) switch { true => (localizer["txtAskForAddress"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForAddress"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Address)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) + false => (localizer["txtAskForAddress"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(address)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -264,16 +276,29 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterAddress; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterAddress), cancellationToken); } private async Task SendRequestForExpectationAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var args = string.IsNullOrEmpty(user.Application.Expectatiopn) switch + var expectatiopn = string.Empty; + var profession = await mediator.Send(new GetProfessionQuery(user.Id), cancellationToken); + var handle = profession switch + { + UserProfession.Representative => mediator.Send(new GetRepresentativeExpectationByUserIdQuery(user.Id), cancellationToken), + UserProfession.ProjectManager => mediator.Send(new GetProjectManagerExpectationByUserIdQuery(user.Id), cancellationToken), + UserProfession.Entrepreneur => throw new NotImplementedException(), + UserProfession.Investor => throw new NotImplementedException(), + _ => Task.FromResult(string.Empty) + }; + + try { expectatiopn = await handle; } + catch (Exception ex) { logger.LogError(ex, "Error handling message from {user.FirstName}", user.FirstName); } + + var args = string.IsNullOrEmpty(expectatiopn) switch { true => (localizer["txtAskForExpectation"], new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (localizer["txtAskForExpectation"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Application.Expectatiopn)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }), - _ => default + false => (localizer["txtAskForExpectation"] + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(expectatiopn)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -282,23 +307,33 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterExpectation; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterExpectation), cancellationToken); } private async Task SendRequestForPurposeAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var askPurpose = user.Profession switch + var purpose = string.Empty; + var askPurpose = string.Empty; + var profession = await mediator.Send(new GetProfessionQuery(user.Id), cancellationToken); + + switch(profession) { - UserProfession.Representative => localizer["txtAskForRepresentativePurpose"], - UserProfession.ProjectManager => localizer["txtAskForProjectManagerPurpose"], - _ => string.Empty + case UserProfession.Representative: + purpose = await mediator.Send(new GetRepresentativePurposeByUserIdQuery(user.Id), cancellationToken); + askPurpose = localizer["txtAskForRepresentativePurpose"]; + break; + case UserProfession.ProjectManager: + purpose = await mediator.Send(new GetProjectManagerPurposeByUserIdQuery(user.Id), cancellationToken); + askPurpose = localizer["txtAskForProjectManagerPurpose"]; + break; + default: + throw new NotImplementedException(); }; - var args = string.IsNullOrEmpty(user.Application.Purpose) switch + var args = string.IsNullOrEmpty(purpose) switch { true => (askPurpose, new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }), - false => (askPurpose + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(user.Application.Purpose)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }), - _ => default + false => (askPurpose + localizer["txtAskWithButton"], new ReplyKeyboardMarkup(new KeyboardButton[][] { [new(purpose)], [new(localizer["rbtnCancel"])] }) { ResizeKeyboard = true }) }; await botClient.SendTextMessageAsync( @@ -307,7 +342,7 @@ await botClient.SendTextMessageAsync( replyMarkup: args.Item2, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterPurpose; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterPurpose), cancellationToken); } private async Task SendRequestForSectorAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -336,12 +371,13 @@ await botClient.SendTextMessageAsync( replyMarkup: new ReplyKeyboardMarkup(new[] { new KeyboardButton(localizer["rbtnCancel"]) }) { ResizeKeyboard = true }, cancellationToken: cancellationToken); - user.State = State.WaitingForEnterSector; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForEnterSector), cancellationToken); } private async Task SendProfessionInfoAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) { - var handler = user.Profession switch + var profession = await mediator.Send(new GetProfessionQuery(user.Id), cancellationToken); + var handler = profession switch { UserProfession.Investor => botClient.SendTextMessageAsync(chatId: message.Chat.Id,text: localizer["txtInfoInvestment"],cancellationToken: cancellationToken), UserProfession.Entrepreneur => botClient.SendTextMessageAsync(chatId: message.Chat.Id, text: localizer["txtInfoEntrepreneurship"], cancellationToken: cancellationToken), diff --git a/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendOther.cs b/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendOther.cs index 46d9622..e63007e 100644 --- a/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendOther.cs +++ b/src/frontend/EcoLink.Bot/BotServices/Senders/BotUpdateHandler.SendOther.cs @@ -6,7 +6,8 @@ private async Task SendGreetingAsync(ITelegramBotClient botClient, Message messa { ArgumentNullException.ThrowIfNull(message); - if (user.State == State.NewUser) + var isUserNew = await mediator.Send(new IsUserNewQuery(user.Id), cancellationToken); + if (isUserNew) { var keyboard = new InlineKeyboardMarkup(new InlineKeyboardButton[][] { [InlineKeyboardButton.WithCallbackData("🇺🇿 o'zbekcha 🇺🇿", "ibtnUz")], @@ -19,11 +20,9 @@ await botClient.SendTextMessageAsync( replyMarkup: keyboard, cancellationToken: cancellationToken); - user.State = State.WaitingForSelectLanguage; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSelectLanguage), cancellationToken); } else await SendMainMenuAsync(botClient, message, cancellationToken); - - await service.UpdateAsync(dto: user, cancellationToken: cancellationToken); } public async Task SendMainMenuAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -42,7 +41,7 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForSelectMainMenu; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSelectMainMenu), cancellationToken); } private async Task SendInfoAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -70,7 +69,7 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForSelectSettings; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSelectSettings), cancellationToken); } private async Task SendFeedbackMenuQueryAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -87,7 +86,7 @@ await botClient.SendTextMessageAsync( replyMarkup: replyKeyboard, cancellationToken: cancellationToken); - user.State = State.WaitingForSelectForFeedback; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSelectForFeedback), cancellationToken); } private async Task SendSelectLanguageQueryAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -107,7 +106,7 @@ await botClient.SendTextMessageAsync( replyMarkup: replyKeyboard, cancellationToken: cancellationToken); - user.State = State.WaitingForSelectLanguage; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSelectLanguage), cancellationToken); } private async Task SendMenuEditPersonalInfoAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -126,7 +125,7 @@ await botClient.SendTextMessageAsync( cancellationToken: cancellationToken ); - user.State = State.WaitingForSelectForEditPersonalInfo; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForSelectPersonalInfo), cancellationToken); } private async Task SendContactAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -154,7 +153,7 @@ await botClient.SendTextMessageAsync( replyMarkup: replyKeyboard, cancellationToken: cancellationToken); - user.State = State.WaitingForFeedbackForTelegramBot; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForFeedbackForTelegramBot), cancellationToken); } private async Task SendRequestFeedbackForOrganizationAsync(ITelegramBotClient botClient, Message message, CancellationToken cancellationToken) @@ -167,6 +166,6 @@ await botClient.SendTextMessageAsync( replyMarkup: replyKeyboard, cancellationToken: cancellationToken); - user.State = State.WaitingForFeedbackForOrganization; + await mediator.Send(new UpdateStateCommand(user.Id, State.WaitingForFeedbackForOrganization), cancellationToken); } } diff --git a/src/frontend/EcoLink.Bot/EcoLink.Bot.csproj b/src/frontend/EcoLink.Bot/EcoLink.Bot.csproj index 523e81f..ba3231c 100644 --- a/src/frontend/EcoLink.Bot/EcoLink.Bot.csproj +++ b/src/frontend/EcoLink.Bot/EcoLink.Bot.csproj @@ -16,7 +16,8 @@ - + + diff --git a/src/frontend/EcoLink.Bot/Program.cs b/src/frontend/EcoLink.Bot/Program.cs index 1d11027..2deb5d3 100644 --- a/src/frontend/EcoLink.Bot/Program.cs +++ b/src/frontend/EcoLink.Bot/Program.cs @@ -1,14 +1,10 @@ using EcoLink.Bot; -using EcoLink.ApiService; var builder = WebApplication.CreateBuilder(args); // Add services builder.Services.AddThis(configuration: builder.Configuration); -// Add API services -builder.Services.AddApiServices(builder.Configuration); - // Build var app = builder.Build(); diff --git a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.en.resx b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.en.resx index 65e386f..5d7ce76 100644 --- a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.en.resx +++ b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.en.resx @@ -117,7 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Great, we will continue with you in English! + + Choose language! + + + Hello, this is a <strong>super</strong> bot \ No newline at end of file diff --git a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.ru.resx b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.ru.resx index 04e0339..aa43810 100644 --- a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.ru.resx +++ b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.ru.resx @@ -117,7 +117,22 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Отлично, мы продолжим с вами на русском языке! + + 📋 Ariza topshirish + + + ☎️ A'loqa + + + ✍️ Fikr bildirish + + + ℹ️ Ma'lumot + + + Menyuni tanlang: + + + ⚙️ Sozlamalar \ No newline at end of file diff --git a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx index d36fed1..d618fdf 100644 --- a/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx +++ b/src/frontend/EcoLink.Bot/Resources/BotLocalizer.uz.resx @@ -400,9 +400,6 @@ Toshkent shahri, O'zbekiston O‘zbekiston Iqtisodiyot Assambleyasining chet elda, O'zbekiston hududida vakil bolish imkoniyati. Vakillik bo'limi haqida ma'lumot berish uchun yuboriladigan xabar - - Ajoyib, siz bilan o'zbek tilida davom ettiramiz! - Menyuni tanlang: Asosiy menyu xabari