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