Directus / @directus/sdk / rest / updateRelation
Function: updateRelation() ​
updateRelation<
Schema
,TQuery
>(collection
,field
,item
,query
?):RestCommand
<IfAny
<Schema
,Record
<string
,any
>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, DirectusRelation<Schema>> extends FF ? MapFlatFields<DirectusRelation<Schema>, FieldsWildcard<DirectusRelation<Schema>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof DirectusRelation<Schema> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>,Schema
>
Defined in: rest/commands/update/relations.ts:21
Update an existing relation.
Type Parameters ​
• Schema
• TQuery extends Query
<Schema
, DirectusRelation
<Schema
>>
Parameters ​
collection ​
string
field ​
string
item ​
collection? ​
string
field? ​
string
meta? ​
NestedUnion
<IfAny
<Schema
, { id
: number
; junction_field
: null
| string
; many_collection
: null
| string
; many_field
: null
| string
; one_allowed_collections
: null
| string
; one_collection
: null
| string
; one_collection_field
: null
| string
; one_deselect_action
: string
; one_field
: null
| string
; sort_field
: null
| string
; system
: null
| boolean
; }, "directus_relations"
extends keyof Schema
? UnpackList
<Schema
[keyof Schema
& "directus_relations"
]> extends Item
? { [Field in string | number | symbol]: Item[Field] } & object
: never
: object
>>
related_collection? ​
string
schema? ​
{ column
: string
; constraint_name
: string
; foreign_key_column
: string
; foreign_key_schema
: string
; foreign_key_table
: string
; on_delete
: string
; on_update
: string
; table
: string
; }
schema.column? ​
string
schema.constraint_name? ​
string
schema.foreign_key_column? ​
string
schema.foreign_key_schema? ​
string
schema.foreign_key_table? ​
string
schema.on_delete? ​
string
schema.on_update? ​
string
schema.table? ​
string
query? ​
TQuery
Returns ​
RestCommand
<IfAny
<Schema
, Record
<string
, any
>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, DirectusRelation<Schema>> extends FF ? MapFlatFields<DirectusRelation<Schema>, FieldsWildcard<DirectusRelation<Schema>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof DirectusRelation<Schema> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>, Schema
>
Returns the relation object for the created relation.