feat: phase 2 — master data (products, customers, drivers) via InsForge-backed Filament pages

This commit is contained in:
sean
2026-08-25 18:33:56 +07:00
parent aad2b5e256
commit 4298544381
12 changed files with 870 additions and 38 deletions
+8 -6
View File
@@ -40,17 +40,17 @@ class InsForgeClient
return $this->request('GET', '/api/auth/profiles/current')->json();
}
public function listRecords(string $table, array $params = []): array
public function listRecords(string $table, array $params = [], bool $asUser = false): array
{
return $this->request('GET', "/api/database/records/{$table}", query: $params)->json() ?? [];
return $this->request('GET', "/api/database/records/{$table}", query: $params, asUser: $asUser)->json() ?? [];
}
public function getRecord(string $table, string $id, array $params = []): ?array
public function getRecord(string $table, string $id, array $params = [], bool $asUser = false): ?array
{
$params['id'] = 'eq.'.$id;
$params['limit'] = 1;
return $this->listRecords($table, $params)[0] ?? null;
return $this->listRecords($table, $params, $asUser)[0] ?? null;
}
public function insertRecord(string $table, array $data, bool $asUser = true): array
@@ -118,9 +118,11 @@ class InsForgeClient
$verb = strtolower($method);
$uri = $query !== [] ? $path.'?'.http_build_query($query) : $path;
$response = in_array($verb, ['get', 'head'])
? $http->{$verb}($path, $query)
: $http->{$verb}($path, $body);
? $http->{$verb}($uri)
: $http->{$verb}($uri, $body);
throw_unless($response->successful(), fn () => InsForgeException::fromResponse(
$response->status(),