create doc
This commit is contained in:
@@ -11,7 +11,6 @@ final class Edge
|
||||
{
|
||||
/**
|
||||
* @param Option<EdgeData> $data
|
||||
* @throws LucentException
|
||||
*/
|
||||
public function __construct(
|
||||
|
||||
@@ -25,10 +24,6 @@ final class Edge
|
||||
public int $depth = 0,
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
LucentValidator::single("source", $source, "required|uuid");
|
||||
LucentValidator::single("target", $target, "required|uuid");
|
||||
}
|
||||
|
||||
public function equal(Edge $edge): bool
|
||||
@@ -53,7 +48,6 @@ final class Edge
|
||||
{
|
||||
|
||||
return new Edge(
|
||||
|
||||
source: data_get($data, 'source'),
|
||||
target: data_get($data, 'target'),
|
||||
sourceSchema: data_get($data, 'sourceSchema'),
|
||||
|
||||
@@ -211,8 +211,7 @@ class RecordController extends Controller
|
||||
->parentsLimit(200)
|
||||
->run();
|
||||
|
||||
|
||||
if ($graph->records->isEmpty()) {
|
||||
if ($graph->rootRecords->isEmpty()) {
|
||||
return $this->svelte->render(
|
||||
layout: "channel",
|
||||
view: "recordNotFound",
|
||||
@@ -222,6 +221,7 @@ class RecordController extends Controller
|
||||
|
||||
$record = $graph->rootRecords->first();
|
||||
|
||||
|
||||
if (!in_array($record->schema, $this->accountService->currentReadableSchemas())) {
|
||||
return $this->svelte->render(
|
||||
layout: "channel",
|
||||
|
||||
@@ -77,7 +77,6 @@ readonly class RecordService
|
||||
return Error::create($errors);
|
||||
}
|
||||
}
|
||||
|
||||
RecordRepo::create($record);
|
||||
$this->edgeService->update($record->id, $uniqueEdges);
|
||||
$this->revisionService->create($record, $uniqueEdges);
|
||||
@@ -92,18 +91,15 @@ readonly class RecordService
|
||||
*/
|
||||
private function getUniqueEdges(Option $edges, string $recordId, string $schemaName): Option
|
||||
{
|
||||
if($edges->isEmpty()){
|
||||
return none();
|
||||
}
|
||||
|
||||
$uniqueEdges = collect($edges)
|
||||
->map(function ($edge, $index) use ($recordId, $schemaName) {
|
||||
$edge['source'] = $recordId;
|
||||
$edge['sourceSchema'] = $schemaName;
|
||||
$edge["rank"] = $index;
|
||||
return $edge;
|
||||
return $edges
|
||||
->map(function ($edges) use ($recordId, $schemaName) {
|
||||
foreach ($edges as $index => $edge) {
|
||||
$edges[$index]['source'] = $recordId;
|
||||
$edges[$index]['sourceSchema'] = $schemaName;
|
||||
$edges[$index]["rank"] = $index;
|
||||
}
|
||||
return EdgeCollection::fromArray($edges);
|
||||
});
|
||||
return some(EdgeCollection::fromArray($uniqueEdges->toArray()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user