using System.Collections.Immutable; using Connected.Entities; using Connected.ServiceModel; using Connected.Services; using Ops = Connected.Logistics.Types.Warehouses.WarehouseOps; namespace Connected.Logistics.Types.Warehouses; /// internal sealed class WarehouseService : EntityService, IWarehouseService { /// /// Creates a new instance. /// /// The context acting as a DI scope. public WarehouseService(IContext context) : base(context) { } /// public async Task Delete(PrimaryKeyArgs args) { await Invoke(GetOperation(), args); } /// public async Task Insert(InsertWarehouseArgs args) { return await Invoke(GetOperation(), args); } /// public async Task> Query(QueryArgs? args) { return await Invoke(GetOperation(), args ?? QueryArgs.Default); } /// public async Task> Query(PrimaryKeyListArgs args) { return await Invoke(GetOperation(), args); } /// public async Task Select(PrimaryKeyArgs args) { return await Invoke(GetOperation(), args); } /// public async Task Update(UpdateWarehouseArgs args) { await Invoke(GetOperation(), args); } /// public async Task Patch(PatchArgs args) { if (await Select(args.Id) is not Warehouse entity) return; await Update(args.Patch(entity)); } }