refactoring of filters

This commit is contained in:
2024-08-24 17:22:40 +03:00
parent 97ad9de3d2
commit d9e2c4954a
57 changed files with 1175 additions and 349 deletions
+11 -11
View File
@@ -8,7 +8,7 @@ use Lucent\Account\AccountService;
use Lucent\Account\AuthService;
use Lucent\Channel\ChannelService;
use Lucent\LucentException;
use Lucent\Query\Operator;
use Lucent\Query\Operator\OperatorRegistry;
use Lucent\Query\Query;
use Lucent\Record\InputData\EdgeInputData;
use Lucent\Record\InputData\RecordInputData;
@@ -25,13 +25,14 @@ use function Lucent\Response\ok;
class RecordController extends Controller
{
public function __construct(
private readonly RecordService $recordService,
private readonly AccountService $accountService,
private readonly AuthService $authService,
private readonly ChannelService $channelService,
private readonly Svelte $svelte,
private readonly Query $query,
private readonly Manager $recordManager
private readonly RecordService $recordService,
private readonly AccountService $accountService,
private readonly AuthService $authService,
private readonly ChannelService $channelService,
private readonly Svelte $svelte,
private readonly Query $query,
private readonly Manager $recordManager,
private readonly OperatorRegistry $operatorRegistry
)
{
}
@@ -79,7 +80,6 @@ class RecordController extends Controller
$records = $graph->getRootRecords()->toArray();
$data = [
"schemas" => $this->channelService->channel->schemas,
"schema" => $schema,
@@ -87,7 +87,7 @@ class RecordController extends Controller
"records" => $records,
"graph" => toArray($graph),
"systemFields" => array_values(System::list()),
"operators" => array_values(Operator::list()),
"operators" => $this->operatorRegistry->all(),
"sortParam" => $sort,
"sortField" => $schema->fields->merge(array_values(System::list()))->firstWhere(fn($field) => $field->name === $sort || "-" . $field->name === $sort || "data." . $field->name === $sort || "-data." . $field->name === $sort),
"limit" => $limit,
@@ -302,7 +302,7 @@ class RecordController extends Controller
id: $request->input("record.id"),
data: $request->input("record.data"),
status: Status::from($request->input("record.status")),
edges: array_map(EdgeInputData::fromArray(...), $request->input("edges") ?? []),
edges: array_map(EdgeInputData::fromArray(...), $request->input("edges") ?? []),
);
}