Merge branch 'v0.0.5.1' of https://git.aycode.com/Adam/TourIAm into v0.0.5.1

This commit is contained in:
Adam 2025-08-30 12:06:17 +02:00
commit 8b4586909f
3 changed files with 29 additions and 8 deletions

View File

@ -10,11 +10,32 @@ namespace TIAM.Database.DbSets.Transfers;
public static class TransferToDriverDbSetExtensions public static class TransferToDriverDbSetExtensions
{ {
#region TransferToDriver #region TransferToDriver
public static TransferToDriver? GetTransferToDriverById(this ITransferToDriverDbSet ctx, Guid transferToDriverId, bool autoInclude = true) public static TransferToDriver? GetTransferToDriverById(this ITransferToDriverDbSet ctx, Guid transferToDriverId, bool autoInclude = true)
=> ctx.TransferToDrivers.FirstOrDefault(x => x.Id == transferToDriverId); => 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);
public static IQueryable<TransferToDriver> GetTransferToDriversByTransferId(this ITransferToDriverDbSet ctx, Guid transferId, bool autoInclude = true) public static IQueryable<TransferToDriver> GetTransferToDriversByTransferId(this ITransferToDriverDbSet ctx, Guid transferId, bool autoInclude = true)
=> ctx.TransferToDrivers.Where(x => x.TransferId == transferId); => 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);
public static IQueryable<TransferToDriver> GetTransferToDriversByUpmId(this ITransferToDriverDbSet ctx, Guid upmId, bool autoInclude = true) public static IQueryable<TransferToDriver> GetTransferToDriversByUpmId(this ITransferToDriverDbSet ctx, Guid upmId, bool autoInclude = true)
=> ctx.TransferToDrivers.Where(x => x.UserProductMappingId == upmId); => ctx.TransferToDrivers.Where(x => x.UserProductMappingId == upmId);

View File

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

View File

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