Add EkaerHistory support: controller, DI, and DbTable

- Added SignalR endpoints for EkaerHistory CRUD in FruitBankDataController.
- Introduced EkaerHistoryDbTable with ordering and query helpers.
- Registered EkaerHistoryDbTable in DI and DbContext.
- Updated appsettings.json to comment out NopLogWriter config with explanation.
This commit is contained in:
Loretta 2026-06-10 16:24:59 +02:00
parent b782d6a88d
commit 9cdd65eebd
4 changed files with 71 additions and 1 deletions

View File

@ -263,6 +263,50 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Controllers
return await ctx.PartnerDepots.GetByIdAsync(partnerDepot.Id, true);
}
[SignalR(SignalRTags.GetEkaerHistories)]
public async Task<List<EkaerHistory>> GetEkaerHistories()
{
_logger.Detail($"GetEkaerHistories invoked");
return await ctx.EkaerHistories.GetAll().ToListAsync();
}
[SignalR(SignalRTags.GetEkaerHistoryById)]
public async Task<EkaerHistory> GetEkaerHistoryById(int id)
{
_logger.Detail($"GetEkaerHistoryById invoked; id: {id}");
return await ctx.EkaerHistories.GetByIdAsync(id);
}
[SignalR(SignalRTags.GetEkaerHistoriesByForeignKey)]
public async Task<List<EkaerHistory>> GetEkaerHistoriesByForeignKey(int foreignKey)
{
_logger.Detail($"GetEkaerHistoriesByForeignKey invoked; foreignKey: {foreignKey}");
return await ctx.EkaerHistories.GetByForeignKey(foreignKey).ToListAsync();
}
[SignalR(SignalRTags.AddEkaerHistory)]
public async Task<EkaerHistory> AddEkaerHistory(EkaerHistory ekaerHistory)
{
ArgumentNullException.ThrowIfNull(ekaerHistory);
_logger.Detail($"AddEkaerHistory invoked; id: {ekaerHistory.Id}");
await ctx.EkaerHistories.InsertAsync(ekaerHistory);
return await ctx.EkaerHistories.GetByIdAsync(ekaerHistory.Id);
}
[SignalR(SignalRTags.UpdateEkaerHistory)]
public async Task<EkaerHistory> UpdateEkaerHistory(EkaerHistory ekaerHistory)
{
ArgumentNullException.ThrowIfNull(ekaerHistory);
_logger.Detail($"UpdateEkaerHistory invoked; id: {ekaerHistory.Id}");
await ctx.EkaerHistories.UpdateAsync(ekaerHistory);
return await ctx.EkaerHistories.GetByIdAsync(ekaerHistory.Id);
}
[SignalR(SignalRTags.GetShippings)]
public async Task<List<Shipping>> GetShippings()
{

View File

@ -0,0 +1,23 @@
using FruitBank.Common.Entities;
using LinqToDB;
using Mango.Nop.Data.Repositories;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Events;
using Nop.Data;
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
public class EkaerHistoryDbTable : MgDbTableBase<EkaerHistory>
{
public EkaerHistoryDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
{
}
// History tábla: legújabb elöl. Nincs asszociáció → nincs LoadWith / loadRelations.
public override IOrderedQueryable<EkaerHistory> GetAll() => base.GetAll().OrderByDescending(p => p.Id);
public Task<EkaerHistory> GetByIdAsync(int id) => GetAll().FirstOrDefaultAsync(p => p.Id == id);
public IQueryable<EkaerHistory> GetByForeignKey(int foreignKey) => GetAll().Where(p => p.ForeignKey == foreignKey);
}

View File

@ -56,6 +56,7 @@ public class FruitBankDbContext : MgDbContextBase,
public PartnerDbTable Partners { get; set; }
public PartnerDepotDbTable PartnerDepots { get; set; }
public EkaerHistoryDbTable EkaerHistories { get; set; }
public CargoPartnerDbTable CargoPartners { get; set; }
public CargoTruckDbTable CargoTrucks{ get; set; }
@ -82,7 +83,7 @@ public class FruitBankDbContext : MgDbContextBase,
public IRepository<StockQuantityHistoryExt> StockQuantityHistoriesExt { get; set; }
public FruitBankDbContext(INopDataProvider dataProvider, ILockService lockService, FruitBankAttributeService fruitBankAttributeService, IStoreContext storeContext,
CargoPartnerDbTable cargoPartnerDbTable, CargoTruckDbTable cargoTruckDbTable, PartnerDbTable partnerDbTable, PartnerDepotDbTable partnerDepotDbTable, ShippingDbTable shippingDbTable, ShippingDocumentDbTable shippingDocumentDbTable, ShippingItemDbTable shippingItemDbTable,
CargoPartnerDbTable cargoPartnerDbTable, CargoTruckDbTable cargoTruckDbTable, PartnerDbTable partnerDbTable, PartnerDepotDbTable partnerDepotDbTable, EkaerHistoryDbTable ekaerHistoryDbTable, ShippingDbTable shippingDbTable, ShippingDocumentDbTable shippingDocumentDbTable, ShippingItemDbTable shippingItemDbTable,
ShippingItemPalletDbTable shippingItemPalletDbTable, FilesDbTable filesDbTable, ShippingDocumentToFilesDbTable shippingDocumentToFilesDbTable,
ProductDtoDbTable productDtoDbTable, OrderDtoDbTable orderDtoDbTable, OrderItemDtoDbTable orderItemDtoDbTable, OrderItemPalletDbTable orderItemPalletDbTable,
StockQuantityHistoryDtoDbTable stockQuantityHistoryDtos, CustomerCreditDbTable customerCreditDbTable,
@ -110,6 +111,7 @@ public class FruitBankDbContext : MgDbContextBase,
Files = filesDbTable;
Partners = partnerDbTable;
PartnerDepots = partnerDepotDbTable;
EkaerHistories = ekaerHistoryDbTable;
CargoPartners = cargoPartnerDbTable;
CargoTrucks = cargoTruckDbTable;

View File

@ -84,6 +84,7 @@ public class PluginNopStartup : INopStartup
services.AddScoped<PartnerDbTable>();
services.AddScoped<PartnerDepotDbTable>();
services.AddScoped<EkaerHistoryDbTable>();
services.AddScoped<CargoPartnerDbTable>();
services.AddScoped<CargoTruckDbTable>();