edges wip
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
<RecordForm
|
<RecordForm
|
||||||
{channel}
|
{channel}
|
||||||
fields={data.fields}
|
fields={data.fields}
|
||||||
|
edgeRecordPreviews={data.edgeRecordPreviewsDraft}
|
||||||
{record}
|
{record}
|
||||||
{selectedLocales}
|
{selectedLocales}
|
||||||
validationErrors={data.validationErrors}
|
validationErrors={data.validationErrors}
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
<RecordForm
|
<RecordForm
|
||||||
{channel}
|
{channel}
|
||||||
fields={data.fields}
|
fields={data.fields}
|
||||||
|
edgeRecordPreviews={data.edgeRecordPreviewsLive}
|
||||||
{record}
|
{record}
|
||||||
{selectedLocales}
|
{selectedLocales}
|
||||||
validationErrors={data.validationErrors}
|
validationErrors={data.validationErrors}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
channel,
|
channel,
|
||||||
validationErrors,
|
validationErrors,
|
||||||
fieldData,
|
fieldData,
|
||||||
|
edgeRecordPreviews,
|
||||||
selectedLocales,
|
selectedLocales,
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
const findFieldValidationError = (field, locale) => {
|
const findFieldValidationError = (field, locale) => {
|
||||||
return validationErrors.find(
|
return validationErrors.find(
|
||||||
(f) => f.fieldId === field.id && f.locale === locale,
|
(f) => f.fieldId === field.id && f.locale === locale,
|
||||||
@@ -20,6 +20,12 @@
|
|||||||
(f) => f.fieldId === field.id && f.locale === locale,
|
(f) => f.fieldId === field.id && f.locale === locale,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
$inspect(edgeRecordPreviews);
|
||||||
|
const findFieldEdges = (field, locale) => {
|
||||||
|
return edgeRecordPreviews.filter(
|
||||||
|
(e) => e.edge.fieldId === field.id && e.edge.locale === locale,
|
||||||
|
);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each fields as field}
|
{#each fields as field}
|
||||||
@@ -62,5 +68,6 @@
|
|||||||
schemaField={field}
|
schemaField={field}
|
||||||
{locale}
|
{locale}
|
||||||
dataField={findDataField(field, locale)}
|
dataField={findDataField(field, locale)}
|
||||||
|
edgeRecordPreviews={findFieldEdges(field, locale)}
|
||||||
></RelationField>
|
></RelationField>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|||||||
@@ -2,8 +2,15 @@
|
|||||||
import { get, post } from "../../../modules/remote";
|
import { get, post } from "../../../modules/remote";
|
||||||
import { getApp } from "../../../app";
|
import { getApp } from "../../../app";
|
||||||
import { getLocaleName } from "../locale.svelte.js";
|
import { getLocaleName } from "../locale.svelte.js";
|
||||||
let { channel, record, schemaField, dataField, locale, validationError } =
|
let {
|
||||||
$props();
|
channel,
|
||||||
|
record,
|
||||||
|
schemaField,
|
||||||
|
dataField,
|
||||||
|
locale,
|
||||||
|
validationError,
|
||||||
|
edgeRecordPreviews,
|
||||||
|
} = $props();
|
||||||
let originalValue = dataField?.value ?? schemaField.props.default;
|
let originalValue = dataField?.value ?? schemaField.props.default;
|
||||||
let newValue = $state(originalValue);
|
let newValue = $state(originalValue);
|
||||||
let valuesChanged = $derived(newValue !== originalValue);
|
let valuesChanged = $derived(newValue !== originalValue);
|
||||||
@@ -14,9 +21,12 @@
|
|||||||
|
|
||||||
let suggestionsLoaded = $state(false);
|
let suggestionsLoaded = $state(false);
|
||||||
let suggestions = $state([]);
|
let suggestions = $state([]);
|
||||||
|
let selectedRecordIds = $state([]);
|
||||||
|
let dialog = $state();
|
||||||
|
|
||||||
function handleAddRecord(e) {
|
function handleModalOpen(e) {
|
||||||
// Add logic to handle adding a record
|
// Add logic to handle adding a record
|
||||||
|
dialog.showModal();
|
||||||
if (suggestionsLoaded) {
|
if (suggestionsLoaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -30,26 +40,24 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function handleModalClose(e) {
|
||||||
if (!valuesChanged) {
|
dialog.close();
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
function handleInsertSelected() {
|
||||||
|
suggestionsLoaded = false;
|
||||||
post(
|
post(
|
||||||
app.url("records/fields"),
|
app.url("edges/many"),
|
||||||
{
|
{
|
||||||
recordId: record.id,
|
toIds: selectedRecordIds,
|
||||||
id: schemaField.id,
|
from: record.id,
|
||||||
|
fieldId: schemaField.id,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
value: newValue,
|
|
||||||
},
|
},
|
||||||
(data, err) => {
|
(data, err) => {
|
||||||
if (err.isNotEmpty()) {
|
suggestionsLoaded = true;
|
||||||
errorMessage = err.first();
|
dialog.close();
|
||||||
} else {
|
edgeRecordPreviews = [...edgeRecordPreviews, ...data];
|
||||||
validationError = data.validationError;
|
|
||||||
originalValue = newValue;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -61,26 +69,68 @@
|
|||||||
{getLocaleName(channel, locale)} >
|
{getLocaleName(channel, locale)} >
|
||||||
{/if}
|
{/if}
|
||||||
{schemaField.name} <br />
|
{schemaField.name} <br />
|
||||||
<details class="dropdown">
|
</label>
|
||||||
<summary onclick={handleAddRecord}>Add Record</summary>
|
{#if hasError}
|
||||||
|
<small id={schemaField.id + "-help"}>{validationError.message}</small>
|
||||||
|
{:else if schemaField.help != ""}
|
||||||
|
<small id={schemaField.id + "-help"}>{schemaField.help}</small>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<button onclick={handleModalOpen}>Choose record</button>
|
||||||
|
|
||||||
|
<dialog bind:this={dialog}>
|
||||||
|
<article>
|
||||||
|
<header>
|
||||||
|
<button onclick={handleModalClose} aria-label="Close" rel="prev"
|
||||||
|
></button>
|
||||||
|
<p>
|
||||||
|
<strong>Records</strong>
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
{#if suggestionsLoaded}
|
{#if suggestionsLoaded}
|
||||||
<ul>
|
<form>
|
||||||
{#each suggestions as suggestion}
|
<button onclick={handleInsertSelected}>
|
||||||
<li><a href="#">{suggestion.title}</a></li>
|
Insert selected
|
||||||
{/each}
|
</button>
|
||||||
<li><a href="#">More</a></li>
|
<table>
|
||||||
</ul>
|
<tbody>
|
||||||
|
{#each suggestions as suggestion}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={suggestion.id}
|
||||||
|
bind:group={selectedRecordIds}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#">{suggestion.title}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="#">
|
||||||
|
{suggestion.schemaName}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
{:else}
|
{:else}
|
||||||
<progress />
|
<progress />
|
||||||
{/if}
|
{/if}
|
||||||
</details>
|
</article>
|
||||||
|
</dialog>
|
||||||
{#if hasError}
|
<div>
|
||||||
<small id={schemaField.id + "-help"}
|
{#if edgeRecordPreviews.length == 0}
|
||||||
>{validationError.message}</small
|
No relations exist
|
||||||
>
|
{:else}
|
||||||
{:else if schemaField.help != ""}
|
{#each edgeRecordPreviews as edgeRecordPreview}
|
||||||
<small id={schemaField.id + "-help"}>{schemaField.help}</small>
|
<div>
|
||||||
|
<a href="#">{edgeRecordPreview.recordPreview.title}</a>
|
||||||
|
{edgeRecordPreview.recordPreview.schemaName}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php namespace Lucent\Core\Data;
|
||||||
|
use Lucent\Core\Data\RecordMode;
|
||||||
|
class Edge
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $id,
|
||||||
|
public string $locale,
|
||||||
|
public RecordMode $mode,
|
||||||
|
public string $from,
|
||||||
|
public string $to,
|
||||||
|
public string $fieldId,
|
||||||
|
public int $rank,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace Lucent\Core\Data;
|
||||||
|
|
||||||
|
class EdgeRecordPreview
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public Edge $edge,
|
||||||
|
public RecordPreview $recordPreview,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ class RecordPreview
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
public string $id,
|
public string $id,
|
||||||
public string $schemaId,
|
public string $schemaId,
|
||||||
|
public string $schemaName,
|
||||||
public string $title,
|
public string $title,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php namespace Lucent\Core\Edge;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Lucent\Core\Data\Edge;
|
||||||
|
use Lucent\Core\Data\RecordMode;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class EdgeModule
|
||||||
|
{
|
||||||
|
public static function toDb(Edge $edge): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
"id" => $edge->id,
|
||||||
|
"locale" => $edge->locale,
|
||||||
|
"mode" => $edge->mode->value,
|
||||||
|
"from" => $edge->from,
|
||||||
|
"to" => $edge->to,
|
||||||
|
"field_id" => $edge->fieldId,
|
||||||
|
"rank" => $edge->rank,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDb(stdClass $data): Edge
|
||||||
|
{
|
||||||
|
return new Edge(
|
||||||
|
id: data_get($data, "id"),
|
||||||
|
locale: data_get($data, "locale"),
|
||||||
|
mode: RecordMode::from(data_get($data, "mode")),
|
||||||
|
from: data_get($data, "from"),
|
||||||
|
to: data_get($data, "to"),
|
||||||
|
fieldId: data_get($data, "field_id"),
|
||||||
|
rank: data_get($data, "rank"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ use Carbon\Carbon;
|
|||||||
use Lucent\Core\Data\Record;
|
use Lucent\Core\Data\Record;
|
||||||
use Lucent\Core\Data\RecordPreview;
|
use Lucent\Core\Data\RecordPreview;
|
||||||
use Lucent\Core\Data\RecordStatus;
|
use Lucent\Core\Data\RecordStatus;
|
||||||
|
use Lucent\Core\Data\EdgeRecordPreview;
|
||||||
|
use Lucent\Core\Edge\EdgeModule;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
class RecordModule
|
class RecordModule
|
||||||
@@ -68,12 +70,45 @@ class RecordModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function recordPreviewFromDb(stdClass $data): RecordPreview
|
/**
|
||||||
{
|
* @param Schema[] $schemas
|
||||||
|
* @param stdClass $data
|
||||||
|
* @return RecordPreview
|
||||||
|
*/
|
||||||
|
public static function recordPreviewFromDb(
|
||||||
|
array $schemas,
|
||||||
|
stdClass $data,
|
||||||
|
): RecordPreview {
|
||||||
return new RecordPreview(
|
return new RecordPreview(
|
||||||
id: data_get($data, "id"),
|
id: data_get($data, "id"),
|
||||||
schemaId: data_get($data, "schema_id"),
|
schemaId: data_get($data, "schema_id"),
|
||||||
|
schemaName: collect($schemas)
|
||||||
|
->where("id", data_get($data, "schema_id"))
|
||||||
|
->first()->name,
|
||||||
|
|
||||||
title: data_get($data, "title"),
|
title: data_get($data, "title"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Schema[] $schemas
|
||||||
|
* @param stdClass $data
|
||||||
|
* @return EdgeRecordPreview
|
||||||
|
*/
|
||||||
|
public static function edgeRecordPreviewFromDb(
|
||||||
|
array $schemas,
|
||||||
|
stdClass $data,
|
||||||
|
): EdgeRecordPreview {
|
||||||
|
return new EdgeRecordPreview(
|
||||||
|
edge: EdgeModule::fromDb($data),
|
||||||
|
recordPreview: new RecordPreview(
|
||||||
|
id: data_get($data, "record_id"),
|
||||||
|
schemaId: data_get($data, "record_schema_id"),
|
||||||
|
schemaName: collect($schemas)
|
||||||
|
->where("id", data_get($data, "record_schema_id"))
|
||||||
|
->first()->name,
|
||||||
|
title: data_get($data, "record_title"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php namespace Lucent\Core\Repository;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Lucent\Core\Data\Edge;
|
||||||
|
use Lucent\Core\Edge\EdgeModule;
|
||||||
|
|
||||||
|
class EdgeRepo
|
||||||
|
{
|
||||||
|
const TABLE_NAME = "edges";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert multiple edges into the database.
|
||||||
|
*
|
||||||
|
* @param Edge[] $edges An array of Edge objects to be inserted.
|
||||||
|
*/
|
||||||
|
public static function insertMany(array $edges): void
|
||||||
|
{
|
||||||
|
DB::table(self::TABLE_NAME)->insert(
|
||||||
|
array_map(EdgeModule::toDb(...), $edges),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Lucent\Core\Data\Record;
|
use Lucent\Core\Data\Record;
|
||||||
use Lucent\Core\Data\RecordPreview;
|
use Lucent\Core\Data\RecordPreview;
|
||||||
|
use Lucent\Core\Data\EdgeRecordPreview;
|
||||||
use Lucent\Core\Record\RecordModule;
|
use Lucent\Core\Record\RecordModule;
|
||||||
|
|
||||||
class RecordRepo
|
class RecordRepo
|
||||||
@@ -30,18 +31,20 @@ class RecordRepo
|
|||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* @param Schema[] $schemas
|
||||||
* @return RecordPreview[]
|
* @return RecordPreview[]
|
||||||
*/
|
*/
|
||||||
public static function findBySchemas(array $schemas): array
|
public static function findBySchemas(array $schemas): array
|
||||||
{
|
{
|
||||||
|
$schemaIds = array_map(fn($schema) => $schema->id, $schemas);
|
||||||
return DB::table(self::TABLE_NAME)
|
return DB::table(self::TABLE_NAME)
|
||||||
->select(
|
->select(
|
||||||
"records.id",
|
"records.id",
|
||||||
"records.schema_id",
|
"records.schema_id",
|
||||||
"records_data.value as title",
|
"records_data.value as title",
|
||||||
)
|
)
|
||||||
->whereIn("schema_id", $schemas)
|
->whereIn("schema_id", $schemaIds)
|
||||||
->join("records_data", function ($join) {
|
->join("records_data", function ($join) {
|
||||||
$join
|
$join
|
||||||
->on("records.id", "=", "records_data.record_id")
|
->on("records.id", "=", "records_data.record_id")
|
||||||
@@ -54,8 +57,45 @@ class RecordRepo
|
|||||||
->orderBy("created_at", "desc")
|
->orderBy("created_at", "desc")
|
||||||
->limit(5)
|
->limit(5)
|
||||||
->get()
|
->get()
|
||||||
|
->map(fn($row) => RecordModule::recordPreviewFromDb($schemas, $row))
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
->map(RecordModule::recordPreviewFromDb(...))
|
/**
|
||||||
|
* @param Schema[] $schemas
|
||||||
|
* @return EdgeRecordPreview[]
|
||||||
|
*/
|
||||||
|
public static function findEdgeRecordPreviewsByRecordId(
|
||||||
|
array $schemas,
|
||||||
|
string $recordId,
|
||||||
|
): array {
|
||||||
|
return DB::table("edges")
|
||||||
|
->select(
|
||||||
|
"edges.*",
|
||||||
|
"records.id as record_id",
|
||||||
|
"records.schema_id as record_schema_id",
|
||||||
|
"records_data.value as record_title",
|
||||||
|
)
|
||||||
|
->where("edges.from", $recordId)
|
||||||
|
->join("records", "edges.from", "=", "records.id")
|
||||||
|
->join("records_data", function ($join) {
|
||||||
|
$join
|
||||||
|
->on("records.id", "=", "records_data.record_id")
|
||||||
|
->on(
|
||||||
|
"records.title_field_id",
|
||||||
|
"=",
|
||||||
|
"records_data.field_id",
|
||||||
|
);
|
||||||
|
})
|
||||||
|
->orderBy("edges.rank", "asc")
|
||||||
|
->get()
|
||||||
|
|
||||||
|
->map(
|
||||||
|
fn($row) => RecordModule::edgeRecordPreviewFromDb(
|
||||||
|
$schemas,
|
||||||
|
$row,
|
||||||
|
),
|
||||||
|
)
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,19 @@ class SchemaRepo
|
|||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Schema[]
|
||||||
|
*/
|
||||||
|
public static function findByIds(array $schemaIds): array
|
||||||
|
{
|
||||||
|
return DB::table(self::TABLE_NAME)
|
||||||
|
->whereIn("id", $schemaIds)
|
||||||
|
->orderBy("name")
|
||||||
|
->get()
|
||||||
|
->map(SchemaModule::fromDb(...))
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static function findOne(string $id): ?Schema
|
public static function findOne(string $id): ?Schema
|
||||||
{
|
{
|
||||||
return DB::table(self::TABLE_NAME)
|
return DB::table(self::TABLE_NAME)
|
||||||
|
|||||||
@@ -4,10 +4,36 @@ namespace Lucent\Http\Controller;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Lucent\Edge\EdgeService;
|
use Lucent\Core\Repository\EdgeRepo;
|
||||||
use Lucent\Query\Query;
|
use Lucent\Core\Data\Edge;
|
||||||
|
use Lucent\Core\Data\RecordMode;
|
||||||
|
use Lucent\Id\Id;
|
||||||
|
use function Lucent\Response\fail;
|
||||||
|
use function Lucent\Response\ok;
|
||||||
|
|
||||||
class EdgeController extends Controller
|
class EdgeController extends Controller
|
||||||
{
|
{
|
||||||
public function postCreate(Request $request) {}
|
public function postCreateMany(Request $request)
|
||||||
|
{
|
||||||
|
$from = $request->input("from");
|
||||||
|
$toIds = $request->input("toIds");
|
||||||
|
$fieldId = $request->input("fieldId");
|
||||||
|
$locale = $request->input("locale");
|
||||||
|
|
||||||
|
$edges = array_map(
|
||||||
|
fn($to) => new Edge(
|
||||||
|
id: Id::new(),
|
||||||
|
from: $from,
|
||||||
|
to: $to,
|
||||||
|
fieldId: $fieldId,
|
||||||
|
locale: $locale,
|
||||||
|
rank: 0,
|
||||||
|
mode: RecordMode::DRAFT,
|
||||||
|
),
|
||||||
|
$toIds,
|
||||||
|
);
|
||||||
|
|
||||||
|
EdgeRepo::insertMany($edges);
|
||||||
|
return ok($edges);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,6 +183,19 @@ class RecordController
|
|||||||
);
|
);
|
||||||
|
|
||||||
$recordStatus = RecordModule::getStatus($record);
|
$recordStatus = RecordModule::getStatus($record);
|
||||||
|
$edgeRecordPreviews = RecordRepo::findEdgeRecordPreviewsByRecordId(
|
||||||
|
$schemas,
|
||||||
|
$record->id,
|
||||||
|
);
|
||||||
|
$edgeRecordPreviewsDraft = collect($edgeRecordPreviews)
|
||||||
|
->where("edge.mode", RecordMode::DRAFT)
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$edgeRecordPreviewsLive = collect($edgeRecordPreviews)
|
||||||
|
->where("edge.mode", RecordMode::LIVE)
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
return Svelte::view(
|
return Svelte::view(
|
||||||
view: "recordEdit",
|
view: "recordEdit",
|
||||||
@@ -191,7 +204,8 @@ class RecordController
|
|||||||
"schemas" => $schemas,
|
"schemas" => $schemas,
|
||||||
"schema" => $schema,
|
"schema" => $schema,
|
||||||
"fields" => $fields,
|
"fields" => $fields,
|
||||||
// "graph" => toArray($graph),
|
"edgeRecordPreviewsDraft" => toArray($edgeRecordPreviewsDraft),
|
||||||
|
"edgeRecordPreviewsLive" => toArray($edgeRecordPreviewsLive),
|
||||||
"record" => toArray($record),
|
"record" => toArray($record),
|
||||||
"draftData" => $draftData,
|
"draftData" => $draftData,
|
||||||
"liveData" => $liveData,
|
"liveData" => $liveData,
|
||||||
@@ -203,7 +217,9 @@ class RecordController
|
|||||||
|
|
||||||
public function suggest(Request $request)
|
public function suggest(Request $request)
|
||||||
{
|
{
|
||||||
$schemas = $request->input("schemas");
|
$schemaIds = $request->input("schemas");
|
||||||
|
$schemas = SchemaRepo::findByIds($schemaIds);
|
||||||
|
|
||||||
$records = RecordRepo::findBySchemas($schemas);
|
$records = RecordRepo::findBySchemas($schemas);
|
||||||
return ok(toArray($records));
|
return ok(toArray($records));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ Route::group(
|
|||||||
RecordController::class,
|
RecordController::class,
|
||||||
"untrash",
|
"untrash",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// EDGES
|
||||||
|
Route::post("edges/many", [
|
||||||
|
EdgeController::class,
|
||||||
|
"postCreateMany",
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
//OLD
|
//OLD
|
||||||
|
|||||||
Reference in New Issue
Block a user