- Customer tab "delete" no longer deletes the service: it detaches the
customer, discards the order/invoices and logs a `detached` activity
with the previous customer and order.
- New POST customers/{uuid}/services/attach assigns an unassigned
service (GET services?unassigned=1) to a customer, creating a pending
order + unpaid invoice when missing, and logs `attached`.
- Detach/attach also sync module_vmware/module_hosting_accounts
customer_id: ResolvesVm authorises by module_vmware.customer_id, so a
detached customer could still control the VM.
- /services detach-customer (single + bulk) go through the same path.
- GET services/{id} returns the service activity logs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
93 lines
6.3 KiB
PHP
93 lines
6.3 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Api\Admin\Customer\CustomerController;
|
|
use App\Http\Controllers\Api\Admin\Service\ServiceController;
|
|
use App\Http\Controllers\Api\Admin\Service\ServiceRenewalReminderController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Customers (module: customer)
|
|
Route::prefix('customers')
|
|
->controller(CustomerController::class)
|
|
->group(function () {
|
|
Route::get('trash', 'trash')->middleware('perm:customer.view');
|
|
Route::get('vps/available', 'listAvailableVms')->middleware('perm:customer.view');
|
|
Route::get('/', 'index')->middleware('perm:customer.view');
|
|
Route::post('/', 'store')->middleware('perm:customer.create');
|
|
Route::get('{uuid}', 'show')->middleware('perm:customer.view');
|
|
Route::put('{uuid}', 'update')->middleware('perm:customer.edit');
|
|
Route::delete('{uuid}', 'destroy')->middleware('perm:customer.destroy');
|
|
Route::delete('{uuid}/destroy', 'destroy')->middleware('perm:customer.destroy');
|
|
Route::post('{uuid}/reset-password', 'resetPassword')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/send-password', 'sendPasswordEmail')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/email-layout', 'emailLayout')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/email-preview', 'emailPreview')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/send-email', 'sendEmail')->middleware('perm:customer.edit');
|
|
Route::get('{uuid}/emails', 'emails')->middleware('perm:customer.view');
|
|
Route::get('{uuid}/emails/{id}', 'emailDetail')->whereNumber('id')->middleware('perm:customer.view');
|
|
Route::post('{uuid}/login-as', 'loginAs')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/add-credit', 'addCredit')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/add-total', 'addTotal')->middleware('perm:customer.edit');
|
|
Route::get('{uuid}/services', 'getServices')->middleware('perm:customer.view');
|
|
Route::post('{uuid}/services', 'createService')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/services/attach', 'attachService')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/services/bulk-delete', 'bulkDeleteServices')->middleware(
|
|
'perm:customer.edit',
|
|
);
|
|
Route::put('{uuid}/services/{serviceId}', 'updateService')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/services/{serviceId}/change-ip', 'changeServiceIp')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/services/{serviceId}/change-port', 'changeServicePort')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/services/{serviceId}/notify-renew', 'notifyServiceRenewal')->middleware('perm:customer.edit');
|
|
Route::get('{uuid}/notes', 'getCustomerNotes')->middleware('perm:customer.view');
|
|
Route::post('{uuid}/notes', 'storeCustomerNote')->middleware('perm:customer.edit');
|
|
Route::delete('{uuid}/notes/{noteId}', 'destroyCustomerNote')->middleware('perm:customer.edit');
|
|
Route::get('{uuid}/services/{serviceId}/notes', 'getServiceNotes')->middleware('perm:customer.view');
|
|
Route::post('{uuid}/services/{serviceId}/notes', 'storeServiceNote')->middleware('perm:customer.edit');
|
|
Route::delete('{uuid}/services/{serviceId}/notes/{noteId}', 'destroyServiceNote')->middleware(
|
|
'perm:customer.edit',
|
|
);
|
|
Route::get('{uuid}/orders', 'getOrders')->middleware('perm:customer.view');
|
|
Route::put('{uuid}/orders/{orderId}', 'updateOrder')->middleware('perm:customer.edit');
|
|
Route::get('{uuid}/invoices', 'getInvoices')->middleware('perm:customer.view');
|
|
Route::put('{uuid}/invoices/{invoiceId}', 'updateInvoice')->middleware(
|
|
'perm:customer.edit',
|
|
);
|
|
Route::get('{uuid}/transactions', 'getTransactions')->middleware('perm:customer.view');
|
|
Route::put('{uuid}/transactions/{transactionId}', 'updateTransaction')->middleware(
|
|
'perm:customer.edit',
|
|
);
|
|
Route::post('{uuid}/transactions', 'createTransaction')->middleware('perm:customer.edit');
|
|
Route::delete('{uuid}/transactions/{transactionId}', 'deleteTransaction')->middleware(
|
|
'perm:customer.edit',
|
|
);
|
|
Route::get('{uuid}/domains', 'getDomains')->middleware('perm:customer.view');
|
|
Route::get('{uuid}/dns-domains', 'getDnsDomains')->middleware('perm:customer.view');
|
|
Route::post('{uuid}/dns-domains/assign', 'assignDnsDomain')->middleware('perm:customer.edit');
|
|
Route::put('{uuid}/dns-domains/{domainId}', 'updateDnsDomain')->middleware('perm:customer.edit');
|
|
Route::delete('{uuid}/dns-domains/{domainId}', 'detachDnsDomain')->middleware('perm:customer.edit');
|
|
Route::get('{uuid}/dns-domains/{domainId}/records', 'getDnsDomainRecords')->middleware(
|
|
'perm:customer.view',
|
|
);
|
|
Route::patch('{uuid}/status', 'updateStatus')->middleware('perm:customer.edit');
|
|
Route::post('bulk-delete', 'bulkDelete')->middleware('perm:customer.destroy');
|
|
Route::post('bulk-restore', 'bulkRestore')->middleware('perm:customer.edit');
|
|
Route::post('bulk-force-delete', 'bulkForceDelete')->middleware('perm:customer.destroy');
|
|
Route::post('bulk-status', 'bulkStatus')->middleware('perm:customer.edit');
|
|
Route::post('{uuid}/restore', 'restore')->middleware('perm:customer.edit');
|
|
Route::delete('{uuid}/force', 'forceDelete')->middleware('perm:customer.destroy');
|
|
});
|
|
|
|
// Services (module: customer)
|
|
Route::prefix('services/renewal-reminders')->controller(ServiceRenewalReminderController::class)->group(function () {
|
|
Route::get('/', 'index')->middleware('perm:customer.view');
|
|
Route::post('/', 'send')->middleware('perm:customer.edit');
|
|
});
|
|
|
|
Route::prefix('services')->controller(ServiceController::class)->group(function () {
|
|
Route::get('/', 'index')->middleware('perm:customer.view');
|
|
Route::post('bulk-action', 'bulkAction')->middleware('perm:customer.edit');
|
|
Route::get('domain-quote', 'domainQuote')->middleware('perm:customer.edit');
|
|
Route::get('{id}', 'show')->middleware('perm:customer.view');
|
|
Route::patch('{id}/detach-customer', 'detachCustomer')->middleware('perm:customer.edit');
|
|
Route::post('{id}/resend-credentials', 'resendCredentials')->middleware('perm:customer.edit');
|
|
});
|