-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'unidevs' of https://github.com/muqimjon/EcoLink into un…
…idevs
- Loading branch information
Showing
52 changed files
with
390 additions
and
505 deletions.
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
src/backend/EcoLink.Application/Commons/Extensions/CollectionExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 3 additions & 34 deletions
37
src/backend/EcoLink.Application/Users/Queries/GetUsers/GetUserByTelegramId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,13 @@ | ||
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<UserResultDto> | ||
{ | ||
public GetUserByTelegramIdQuery(long telegramId) { TelegramId = telegramId; } | ||
public long TelegramId { get; set; } | ||
} | ||
|
||
public class GetUserByTelegramIdQueryHandler(IMapper mapper, | ||
IRepository<User> repository, | ||
IRepository<Investor> investorRepository, | ||
IRepository<Entrepreneur> entrepreneurRepository, | ||
IRepository<Representative> representativeRepository, | ||
IRepository<ProjectManager> projectManagerRepository) : | ||
IRequestHandler<GetUserByTelegramIdQuery, UserResultDto> | ||
public class GetUserByTelegramIdQueryHandler(IRepository<User> repository, IMapper mapper) : IRequestHandler<GetUserByTelegramIdQuery, UserResultDto> | ||
{ | ||
public async Task<UserResultDto> Handle(GetUserByTelegramIdQuery request, CancellationToken cancellationToken) | ||
{ | ||
var resultDto = mapper.Map<UserResultDto>(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<InvestorResultDto>(await investorRepository.SelectAsync(i => i.UserId == resultDto.Id)); | ||
break; | ||
case UserProfession.Entrepreneur: | ||
resultDto.Application = mapper.Map<EntrepreneurResultDto>(await entrepreneurRepository.SelectAsync(i => i.UserId == resultDto.Id)); | ||
break; | ||
case UserProfession.Representative: | ||
resultDto.Application = mapper.Map<RepresentativeResultDto>(await representativeRepository.SelectAsync(i => i.UserId == resultDto.Id)); | ||
break; | ||
case UserProfession.ProjectManager: | ||
resultDto.Application = mapper.Map<ProjectManagerResultDto>(await projectManagerRepository.SelectAsync(i => i.UserId == resultDto.Id)); | ||
break; | ||
}; | ||
return resultDto; | ||
} | ||
=> mapper.Map<UserResultDto>(await repository.SelectAsync(i => i.TelegramId == request.TelegramId)); | ||
} |
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/backend/EcoLink.Domain/Configurations/PaginationMetaData.cs
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/backend/EcoLink.Domain/Configurations/PaginationParams.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
src/backend/EcoLink.WebApi/Controllers/Entrepreneurship/EntrepreneurshipAppsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<IActionResult> Create(CreateEntrepreneurshipAppWithReturnCommand command, CancellationToken cancellationToken = default) | ||
=> Ok(new Response { Data = await mediator.Send(new CreateEntrepreneurshipAppWithReturnCommand(command), cancellationToken) }); | ||
public async Task<IActionResult> Create(CreateEntrepreneurshipAppWithReturnCommand command) | ||
=> Ok(await mediator.Send(new CreateEntrepreneurshipAppWithReturnCommand(command))); | ||
|
||
[HttpGet("get-all-by-user-id/{userId:long}")] | ||
public async Task<IActionResult> GetAllByUserId(long userId, CancellationToken cancellationToken = default) | ||
=> Ok(new Response { Data = await mediator.Send(new GetAllEntrepreneurshipAppsByUserIdQuery(userId), cancellationToken) }); | ||
public async Task<IActionResult> GetAllByUserId(long userId) | ||
=> Ok(await mediator.Send(new GetAllEntrepreneurshipAppsByUserIdQuery(userId))); | ||
|
||
[HttpGet("get/{id:long}")] | ||
public async Task<IActionResult> Get(long id, CancellationToken cancellationToken = default) | ||
=> Ok(new Response { Data = await mediator.Send(new GetEntrepreneurshipAppByIdCommand(id), cancellationToken) }); | ||
public async Task<IActionResult> Get(long id) | ||
=> Ok(await mediator.Send(new GetEntrepreneurshipAppByIdCommand(id))); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.