Refactor: Migrate models to domain-driven architecture#3128
Open
Refactor: Migrate models to domain-driven architecture#3128
Conversation
BREAKING CHANGE: All models moved from app/models to domain-specific locations ## Summary - Migrated 102 models from app/models/ to app/Domains/[Domain]/Models/ - Updated 704 files with 1,191 namespace import changes - Created 4 new domains: Core, Company, Tax, Collections - Updated configuration files and service providers ## New Domain Structure ### Core Domain (22 models) - Auth & Access: User, Role, Permission, PermissionGroup - Settings: Setting, SettingsConfiguration, UserSetting, + 12 Settings/* models - Shared Data: Tag, File, Document - System: AuditLog, NotificationPreference, InAppNotification, MailTemplate, MailQueue - UI: DashboardWidget, CustomQuickAction, QuickActionFavorite - Analytics: AnalyticsSnapshot, KpiCalculation, PortalNotification ### Company Domain (10 models) Company, CompanyCustomization, CompanyHierarchy, CompanyMailSettings, CompanySubscription, CrossCompanyUser, SubsidiaryPermission, Account, AccountHold, CreditApplication ### Tax Domain (13 models) Tax, TaxCalculation, TaxProfile, TaxJurisdiction, TaxRateHistory, TaxExemption, TaxExemptionUsage, TaxApiSettings, TaxApiQueryCache, ServiceTaxRate, ProductTaxData, ComplianceCheck, ComplianceRequirement ### Collections Domain (4 models) DunningSequence, DunningCampaign, DunningAction, CollectionNote ### Financial Domain (22 models) Invoice, InvoiceItem, RecurringInvoice, Recurring, Payment, PaymentMethod, PaymentApplication, PaymentPlan, AutoPayment, CreditNote, CreditNoteItem, CreditNoteApproval, ClientCredit, ClientCreditApplication, RefundRequest, RefundTransaction, Quote, QuoteApproval, QuoteTemplate, QuoteVersion, QuoteInvoiceConversion, Category, CashFlowProjection, RevenueMetric, FinancialReport, Expense ### Client Domain (9 models) Contact, Address, Location, Network, ClientDocument, CommunicationLog, ClientPortalAccess, ClientPortalSession, ClientPortalUser ### Product Domain (10 models) Product, Service, ProductBundle, SubscriptionPlan, PricingRule, UsageRecord, UsagePool, UsageBucket, UsageAlert, UsageTier ### Other Domains (7 models) - Asset: Asset - Ticket: TicketRating, TimeEntry - Project: Project, Vendor - Contract: ContractConfiguration - PhysicalMail: PhysicalMailSettings ## Files Changed - Models moved: 102 - Configuration files updated: 2 (config/auth.php, config/bouncer.php) - Service providers updated: 1 (AppServiceProvider.php) - Interfaces updated: 1 (EmailServiceInterface.php) - Import statements updated across: Controllers, Services, Livewire, Policies, Observers, Jobs, Events, Factories, Seeders, Tests ## Migration Script Created scripts/update-model-imports.php for automated namespace updates ## Benefits - Clearer domain boundaries and responsibilities - Better code organization and discoverability - Improved separation of concerns - Foundation for potential microservices architecture - Easier to understand business logic flow 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Test plan
🤖 Generated with Claude Code
https://claude.com/claude-code