Initial commit
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
using PowderCoating.Core.Entities;
|
||||
|
||||
namespace PowderCoating.Core.Interfaces;
|
||||
|
||||
public interface IUnitOfWork : IDisposable
|
||||
{
|
||||
// Multi-tenancy
|
||||
IRepository<Company> Companies { get; }
|
||||
IRepository<CompanyOperatingCosts> CompanyOperatingCosts { get; }
|
||||
IRepository<CompanyPreferences> CompanyPreferences { get; }
|
||||
|
||||
// AI Predictions
|
||||
IRepository<AiItemPrediction> AiItemPredictions { get; }
|
||||
|
||||
// Powder Insights
|
||||
IRepository<PowderUsageLog> PowderUsageLogs { get; }
|
||||
|
||||
// Core entities
|
||||
IRepository<Customer> Customers { get; }
|
||||
IRepository<Job> Jobs { get; }
|
||||
IRepository<JobDailyPriority> JobDailyPriorities { get; }
|
||||
IRepository<JobItem> JobItems { get; }
|
||||
IRepository<JobItemCoat> JobItemCoats { get; }
|
||||
IRepository<JobChangeHistory> JobChangeHistories { get; }
|
||||
IRepository<Quote> Quotes { get; }
|
||||
IRepository<QuotePhoto> QuotePhotos { get; }
|
||||
IRepository<QuoteItem> QuoteItems { get; }
|
||||
IRepository<QuoteItemCoat> QuoteItemCoats { get; }
|
||||
IRepository<QuoteItemPrepService> QuoteItemPrepServices { get; }
|
||||
IRepository<QuoteChangeHistory> QuoteChangeHistories { get; }
|
||||
IRepository<InventoryItem> InventoryItems { get; }
|
||||
IRepository<InventoryTransaction> InventoryTransactions { get; }
|
||||
IRepository<Equipment> Equipment { get; }
|
||||
IRepository<OvenCost> OvenCosts { get; }
|
||||
IRepository<CompanyBlastSetup> BlastSetups { get; }
|
||||
IRepository<MaintenanceRecord> MaintenanceRecords { get; }
|
||||
IRepository<Vendor> Vendors { get; }
|
||||
IRepository<JobPhoto> JobPhotos { get; }
|
||||
IRepository<JobNote> JobNotes { get; }
|
||||
IRepository<CustomerNote> CustomerNotes { get; }
|
||||
IRepository<JobStatusHistory> JobStatusHistory { get; }
|
||||
IRepository<PricingTier> PricingTiers { get; }
|
||||
|
||||
// Lookup tables (replacing enums)
|
||||
IRepository<JobStatusLookup> JobStatusLookups { get; }
|
||||
IRepository<JobPriorityLookup> JobPriorityLookups { get; }
|
||||
IRepository<QuoteStatusLookup> QuoteStatusLookups { get; }
|
||||
IRepository<InventoryCategoryLookup> InventoryCategoryLookups { get; }
|
||||
IRepository<AppointmentStatusLookup> AppointmentStatusLookups { get; }
|
||||
IRepository<AppointmentTypeLookup> AppointmentTypeLookups { get; }
|
||||
IRepository<PrepService> PrepServices { get; }
|
||||
IRepository<ShopWorker> ShopWorkers { get; }
|
||||
IRepository<ShopWorkerRoleCost> ShopWorkerRoleCosts { get; }
|
||||
IRepository<ReworkRecord> ReworkRecords { get; }
|
||||
IRepository<Refund> Refunds { get; }
|
||||
IRepository<CreditMemo> CreditMemos { get; }
|
||||
IRepository<CreditMemoApplication> CreditMemoApplications { get; }
|
||||
IRepository<JobTimeEntry> JobTimeEntries { get; }
|
||||
|
||||
// Appointments
|
||||
IRepository<Appointment> Appointments { get; }
|
||||
|
||||
// Product Catalog
|
||||
IRepository<CatalogCategory> CatalogCategories { get; }
|
||||
IRepository<CatalogItem> CatalogItems { get; }
|
||||
|
||||
// Oven Scheduling
|
||||
IRepository<OvenBatch> OvenBatches { get; }
|
||||
IRepository<OvenBatchItem> OvenBatchItems { get; }
|
||||
|
||||
// Invoices, Payments & Deposits
|
||||
IRepository<Invoice> Invoices { get; }
|
||||
IRepository<InvoiceItem> InvoiceItems { get; }
|
||||
IRepository<Payment> Payments { get; }
|
||||
IRepository<Deposit> Deposits { get; }
|
||||
|
||||
// Purchase Orders
|
||||
IRepository<PurchaseOrder> PurchaseOrders { get; }
|
||||
IRepository<PurchaseOrderItem> PurchaseOrderItems { get; }
|
||||
|
||||
// Expense Tracking / Accounts Payable
|
||||
IRepository<Account> Accounts { get; }
|
||||
IRepository<Bill> Bills { get; }
|
||||
IRepository<BillLineItem> BillLineItems { get; }
|
||||
IRepository<BillPayment> BillPayments { get; }
|
||||
IRepository<Expense> Expenses { get; }
|
||||
|
||||
// Notifications
|
||||
IRepository<NotificationLog> NotificationLogs { get; }
|
||||
IRepository<NotificationTemplate> NotificationTemplates { get; }
|
||||
|
||||
// Subscription
|
||||
IRepository<SubscriptionPlanConfig> SubscriptionPlanConfigs { get; }
|
||||
|
||||
// Job Templates
|
||||
IRepository<JobTemplate> JobTemplates { get; }
|
||||
IRepository<JobTemplateItem> JobTemplateItems { get; }
|
||||
IRepository<JobTemplateItemCoat> JobTemplateItemCoats { get; }
|
||||
IRepository<JobTemplateItemPrepService> JobTemplateItemPrepServices { get; }
|
||||
|
||||
// Bug Reports
|
||||
IRepository<BugReport> BugReports { get; }
|
||||
|
||||
// Contact Us
|
||||
IRepository<ContactSubmission> ContactSubmissions { get; }
|
||||
|
||||
// AI lookup: per-manufacturer URL patterns
|
||||
IRepository<ManufacturerLookupPattern> ManufacturerLookupPatterns { get; }
|
||||
|
||||
// Gift Certificates
|
||||
IRepository<GiftCertificate> GiftCertificates { get; }
|
||||
IRepository<GiftCertificateRedemption> GiftCertificateRedemptions { get; }
|
||||
|
||||
Task<int> SaveChangesAsync();
|
||||
Task<int> CompleteAsync(); // Alias for SaveChangesAsync
|
||||
|
||||
/// <summary>
|
||||
/// Executes <paramref name="operation"/> inside a database transaction using EF Core's
|
||||
/// execution strategy, enabling compatibility with SqlServerRetryingExecutionStrategy.
|
||||
/// Commits on success and rolls back on any exception (which is re-thrown).
|
||||
/// </summary>
|
||||
Task ExecuteInTransactionAsync(Func<Task> operation);
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="ExecuteInTransactionAsync(Func{Task})"/> but returns a value.
|
||||
/// </summary>
|
||||
Task<T> ExecuteInTransactionAsync<T>(Func<Task<T>> operation);
|
||||
|
||||
/// <summary>
|
||||
/// Detaches all tracked entities from the change tracker.
|
||||
/// Use after a failed save to prevent contaminating subsequent operations.
|
||||
/// </summary>
|
||||
void ClearChangeTracker();
|
||||
|
||||
// Kept for backwards-compatibility — prefer ExecuteInTransactionAsync for new code.
|
||||
Task BeginTransactionAsync();
|
||||
Task CommitTransactionAsync();
|
||||
Task RollbackTransactionAsync();
|
||||
}
|
||||
Reference in New Issue
Block a user