Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

update mapping #149

Merged
merged 9 commits into from
Nov 10, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Server/Features/OfferMatching/List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ public async Task<OfferMatchingListResult> Handle(ListQuery request, Cancellatio

var offerMatches = await _dbContext.Players
.Include(p => p.Bids)
.ThenInclude(b => b.Team)
.Where(p => p.State == PlayerState.OfferMatching)
.ProjectTo<OfferMatchingListResult.OfferMatchingItem>(_mapper.ConfigurationProvider, new { currentUserTeamId })
.ToListAsync(cancellationToken);


return new OfferMatchingListResult
{
OfferMatches = offerMatches
Expand All @@ -64,7 +66,7 @@ public ListMappingProfile()

CreateMap<Player, OfferMatchingListResult.OfferMatchingItem>()
.ForMember(d => d.Team, mo => mo.MapFrom(s => s.Team.Name))
.ForMember(d => d.OfferingTeam, mo => mo.MapFrom(s => s.Team != null ? s.Team.Name : string.Empty))
.ForMember(d => d.OfferingTeam, mo => mo.MapFrom(s => s.Bids.FindHighestBid()!.Team.Name != null ? s.Team.Name : string.Empty))
morkusporkus marked this conversation as resolved.
Show resolved Hide resolved
.ForMember(d => d.Offer, mo => mo.MapFrom(s => s.GetHighestBidAmount()))
.ForMember(d => d.CurrentUserIsOfferMatching, mo => mo.MapFrom(s => s.TeamId == currentUserTeamId))
.ForMember(d => d.RemainingTime, mo => mo.MapFrom(s => s.GetRemainingFreeAgencyTime()));
Expand Down