1
Architecture
Jonathan Miller edited this page 2026-06-29 16:40:37 +00:00

Architecture

Package Structure

MokoSuiteStorage is a Joomla 6 package extension with three sub-extensions:

source/
├── pkg_mokosuitestorage.xml              # Package manifest
├── script.php                            # Package install/update script
└── packages/
    ├── com_mokosuitestorage/             # Admin component
    │   ├── mokosuitestorage.xml          # Component manifest
    │   └── admin/
    │       ├── access.xml               # ACL definitions
    │       ├── config.xml               # Component parameters
    │       ├── language/en-GB/          # Language strings
    │       ├── services/provider.php    # DI service provider
    │       ├── src/
    │       │   ├── Controller/
    │       │   │   └── DisplayController.php
    │       │   ├── Model/
    │       │   │   └── StorageDashboardModel.php
    │       │   └── View/
    │       │       ├── AccessLog/HtmlView.php
    │       │       ├── Facilities/HtmlView.php
    │       │       ├── Leases/HtmlView.php
    │       │       ├── Payments/HtmlView.php
    │       │       ├── StorageAccess/HtmlView.php
    │       │       ├── StorageAccessLogs/HtmlView.php
    │       │       ├── StorageDashboard/HtmlView.php
    │       │       ├── StorageFacilities/HtmlView.php
    │       │       ├── StorageLeases/HtmlView.php
    │       │       ├── StoragePayments/HtmlView.php
    │       │       ├── StorageRentals/HtmlView.php
    │       │       ├── StorageTenants/HtmlView.php
    │       │       ├── StorageUnitTypes/HtmlView.php
    │       │       ├── StorageUnits/HtmlView.php
    │       │       ├── StorageWaitlist/HtmlView.php
    │       │       ├── Tenants/HtmlView.php
    │       │       └── Units/HtmlView.php
    │       └── tmpl/                    # View templates
    │           ├── storageaccess/default.php
    │           ├── storageaccesslogs/default.php
    │           ├── storagedashboard/default.php
    │           ├── storagefacilities/default.php
    │           ├── storageleases/default.php
    │           ├── storagepayments/default.php
    │           ├── storagerentals/default.php
    │           ├── storagetenants/default.php
    │           ├── storageunits/default.php
    │           ├── storageunittypes/default.php
    │           └── storagewaitlist/default.php
    ├── plg_system_mokosuitestorage/      # System plugin
    │   ├── mokosuitestorage.xml         # Plugin manifest
    │   ├── services/provider.php        # DI service provider
    │   ├── sql/
    │   │   ├── install.mysql.sql        # Schema creation (8 tables)
    │   │   └── uninstall.mysql.sql      # Schema teardown
    │   └── src/Extension/Storage.php    # Plugin extension class
    └── plg_webservices_mokosuitestorage/ # Web services plugin
        ├── mokosuitestorage.xml         # Plugin manifest
        ├── services/provider.php        # DI service provider
        └── src/Extension/MokoSuiteStorage.php  # API route registration

MVC Architecture

Namespace

  • Component: Moko\Component\MokoSuiteStorage
  • System Plugin: MokoConsulting\Plugin\System\MokoSuiteStorage
  • Webservices Plugin: MokoConsulting\Plugin\WebServices\MokoSuiteStorage

Controllers

Controller Purpose
DisplayController Default display controller for admin views

Models

Model Purpose
StorageDashboardModel Dashboard metrics and aggregation (scaffold)

Planned models (per open issues): FacilitiesModel, FacilityModel, UnitsModel, UnitModel, LeasesModel, LeaseModel, TenantsModel, TenantModel, PaymentsModel, PaymentModel, AccessLogModel, WaitlistModel

Views (Admin)

The component has 17 HtmlView classes organized by entity:

View Purpose
StorageDashboard Occupancy, revenue, and delinquency metrics
StorageFacilities / Facilities Facility list and management
StorageUnits / Units Unit inventory management
StorageUnitTypes Unit type/size configuration
StorageRentals Rental agreement overview
StorageLeases / Leases Lease management
StorageTenants / Tenants Tenant records
StoragePayments / Payments Payment tracking
StorageAccess Gate access management
StorageAccessLogs / AccessLog Access event history
StorageWaitlist Unit waitlist management

Templates

All admin templates are currently placeholder scaffolds (display view title only). Full implementations are planned in the roadmap issues.

Plugin Architecture

System Plugin (plg_system_mokosuitestorage)

  • Schema owner: Manages all database table creation/teardown via sql/install.mysql.sql and sql/uninstall.mysql.sql
  • Bootstrap: Initializes the Storage subsystem
  • Extension class: Storage.php — currently a minimal scaffold
  • Planned: Helpers for business logic (FacilityHelper, LeaseHelper, BillingHelper, AccessHelper, WaitlistHelper, DashboardHelper)

Webservices Plugin (plg_webservices_mokosuitestorage)

  • Registers REST API routes for Storage entities
  • Extension class: MokoSuiteStorage.php — route stubs, pending API controller implementation
  • Planned endpoints: Facilities CRUD, Units CRUD, Leases CRUD, Payments recording, Access log queries

Cross-Module Integration

MokoSuiteStorage integrates with other MokoSuite modules:

Integration Direction Purpose
CRM Contacts Storage → CRM Tenants link to CRM contacts via tenants.contact_id
CRM Invoicing Storage → CRM Rent invoices generated through CRM invoicing system
ERP Accounting Storage → ERP Payments create GL journal entries (Rental Income, Late Fees, Security Deposits)

Development Status

Current state: Scaffold with full infrastructure. Admin views exist for all entities but most lack models, helpers, and functional templates. Database schema is complete with 8 tables and full FK relationships.

Open issues: 8 (see Roadmap #2)