From 9f4beee08fd642579efc7999b2b343bfeaa8f867 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Mon, 13 Mar 2023 18:26:46 +0000 Subject: [PATCH] feat: auto-fill relationship attribute key --- .../attributes/relationship.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte index d3fe553fc..8abec8377 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte @@ -123,6 +123,14 @@ $: if (data.required || data.array) { data.default = null; } + + $: console.log(data.related); + + $: if (data.related && !data.key) { + const collection = collectionList.collections.find((n) => n.$id === data.related); + // data key = data related in snake case + data.key = collection.name.replace(/\s+/g, '_').toLowerCase(); + }