Compare commits

..

No commits in common. "b1f5a1cfd9b123b802b95ab62ebeedb38e00e19a" and "3265731367a69da94a4ab7fe343c6d913229e160" have entirely different histories.

3 changed files with 8 additions and 29 deletions

View File

@ -10,32 +10,11 @@ namespace TIAM.Database.DbSets.Transfers;
public static class TransferToDriverDbSetExtensions
{
#region TransferToDriver
public static TransferToDriver? GetTransferToDriverById(this ITransferToDriverDbSet ctx, Guid transferToDriverId, bool autoInclude = true)
=> ctx.TransferToDrivers
.Where(x => x.Id == transferToDriverId)
.Include(x => x.UserProductMapping.User.Products).ThenInclude(x => x.UserProductMappings)
.Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products)
.Include(x => x.UserProductMapping.User.Profile.Address)
.Include(x => x.Transfer)
.FirstOrDefault(x => x.Id == transferToDriverId);
=> ctx.TransferToDrivers.FirstOrDefault(x => x.Id == transferToDriverId);
public static IQueryable<TransferToDriver> GetTransferToDriversByTransferId(this ITransferToDriverDbSet ctx, Guid transferId, bool autoInclude = true)
=> ctx.TransferToDrivers
.Where(x => x.TransferId == transferId)
.Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products)
.Include(x => x.UserProductMapping.User.Profile.Address)
.Include(x => x.Transfer);
//.Include(x => x.UserProductMapping.User.Products).ThenInclude(x => x.UserProductMappings)
//.Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products)
//.Include(x => x.UserProductMapping.User.Profile.Address)
//.Include(x => x.Transfer);
//.Include(x => x.UserProductMapping.User.Products).ThenInclude(x => x.UserProductMappings).ThenInclude(x => x.User.Profile.Address)
//.Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products)
//.Include(x => x.UserProductMapping.User.Profile.Address)
//.Include(x => x.Transfer);
=> ctx.TransferToDrivers.Where(x => x.TransferId == transferId);
public static IQueryable<TransferToDriver> GetTransferToDriversByUpmId(this ITransferToDriverDbSet ctx, Guid upmId, bool autoInclude = true)
=> ctx.TransferToDrivers.Where(x => x.UserProductMappingId == upmId);

View File

@ -766,10 +766,11 @@ namespace TIAMWebApp.Server.Controllers
_logger.Debug($"GetTransferDrivers called; transferId: {transferId}");
var result = await _adminDal.GetTransferToDriversByTransferIdAsync(transferId);
//System.IO.File.WriteAllText($"h://TiamJsons//{transferId}.json", result.ToJson());
return result;
if(result == null)
{
_logger.Warning("Null result", "GetTransferDrivers");
}
return result;
}
//[Authorize]

View File

@ -308,8 +308,7 @@ namespace Tiam.Services.Client.Tests
}
[TestMethod]
//[DataRow("ddf26c38-933e-45aa-ad1f-76f6affc9fd1")]
[DataRow("fe68bac6-b180-4311-8df0-41f3587f28c7")]
[DataRow("ddf26c38-933e-45aa-ad1f-76f6affc9fd1")]
public async Task GetTransferDiversByTransferIdAsyncTest_ReturnDrivers_WhenHasDrivers(string transferIdString)
{
var transferId = Guid.Parse(transferIdString);