['auth:sanctum']]); // --- Public / Auth Routes --- Route::post('/auth/login', [AuthController::class, 'login']); Route::post('/auth/register', [AuthController::class, 'register']); // --- Protected Routes (Perlu Login) --- Route::middleware('auth:sanctum')->group(function () { // Media Upload Route::post('/uploads/images', [UploadController::class, 'uploadImage']); // Core Synchronization Route::prefix('sync')->group(function () { Route::post('/up', [SyncController::class, 'batchUpSync']); Route::get('/down', [SyncController::class, 'getDeltaSync']); }); // Order Synchronization Route::get('orders/sync/{orderId}', [OrderController::class, 'getOrderSync']); }); // --- Tenant Specific Routes (Ecommerce / Client Side) --- Route::middleware('identify.tenant')->group(function() { Route::prefix('tenant')->group(function() { Route::get('/', [ConfigurationController::class, 'getConfigurationService']); }); // Home & Storefront Route::get('/home/{outletId}', [HomeController::class, 'home']); Route::get('/outlets', [HomeController::class, 'getOutlets']); Route::get('/outlets/main', [HomeController::class, 'getMainOutlet']); // Products Route::prefix('products')->group(function () { Route::get('/{id}', [ProductController::class, 'getProductById']); Route::get('/search/{outletId}', [ProductController::class, 'getProductByName']); // Ganti dari search-products Route::get('/categories/{outletId}/{categoryId}', [ProductController::class, 'getProductByCategory']); Route::get('/best-sellers/{outletId}', [ProductController::class, 'getProductBestSellerByOutlet']); }); // Orders & Checkout Route::post('/checkout', [CheckoutController::class, 'store']); Route::prefix('orders')->group(function () { Route::get('/customer/{customerId}', [OrderController::class, 'getOrders']); Route::get('/customer/{customerId}/{orderId}', [OrderController::class, 'getOrderById']); Route::patch('/{customerId}/{orderId}/cancel', [OrderController::class, 'cancelOrder']); Route::patch('/{customerId}/{orderId}/cancellation-request', [OrderController::class, 'cancellationRequest']); }); Route::prefix('review')->group(function() { Route::get('/{orderId}', [ReviewController::class, 'getProductReviewItem']); Route::post('/{orderId}', [ReviewController::class, 'reviewProduct']); }); Route::prefix('customer')->group(function() { Route::post('/auth/login', [CustomerController::class, 'login']); Route::post('/auth/register', [CustomerController::class, 'register']); Route::patch('/{customerId}', [CustomerController::class, 'updateCustomer']); Route::patch('/{customerId}/password', [CustomerController::class, 'updatePassword']); Route::post('/{customerId}', [CustomerController::class, 'saveCustomerAddress']); Route::get('/{customerId}/addresses', [CustomerController::class, 'getCustomerAddress']); Route::delete('/{customerId}/addresses/{id}', [CustomerController::class, 'deleteCustomerAddress']); }); });