Allow edit
This commit is contained in:
parent
9b45c1fe92
commit
753cb442c2
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { getContext } from "svelte"
|
||||
import RelationshipCell from "./RelationshipCell.svelte"
|
||||
import { FieldSubtype } from "@budibase/types"
|
||||
import { FieldSubtype, RelationshipType } from "@budibase/types"
|
||||
|
||||
export let api
|
||||
|
||||
|
@ -12,10 +12,14 @@
|
|||
...$$props.schema,
|
||||
// This is not really used, just adding some content to be able to render the relationship cell
|
||||
tableId: "external",
|
||||
relationshipType:
|
||||
subtype === FieldSubtype.USER
|
||||
? RelationshipType.ONE_TO_MANY
|
||||
: RelationshipType.MANY_TO_MANY,
|
||||
}
|
||||
|
||||
async function searchFunction(searchParams) {
|
||||
if (subtype !== FieldSubtype.USER) {
|
||||
if (subtype !== FieldSubtype.USER && subtype !== FieldSubtype.USERS) {
|
||||
throw `Search for '${subtype}' not implemented`
|
||||
}
|
||||
|
||||
|
|
|
@ -28,18 +28,17 @@ export async function processInputBBReferences(
|
|||
|
||||
switch (subtype) {
|
||||
case FieldSubtype.USER:
|
||||
case FieldSubtype.USERS:
|
||||
const { notFoundIds } = await cache.user.getUsers(referenceIds)
|
||||
|
||||
if (notFoundIds?.length) {
|
||||
throw new InvalidBBRefError(notFoundIds[0], FieldSubtype.USER)
|
||||
}
|
||||
return referenceIds.join(",") || null
|
||||
|
||||
break
|
||||
default:
|
||||
throw utils.unreachable(subtype)
|
||||
}
|
||||
|
||||
return referenceIds.join(",") || null
|
||||
}
|
||||
|
||||
export async function processOutputBBReferences(
|
||||
|
@ -55,6 +54,7 @@ export async function processOutputBBReferences(
|
|||
|
||||
switch (subtype) {
|
||||
case FieldSubtype.USER:
|
||||
case FieldSubtype.USERS:
|
||||
const { users } = await cache.user.getUsers(ids)
|
||||
if (!users.length) {
|
||||
return undefined
|
||||
|
|
Loading…
Reference in New Issue