feat: adds req to filterOptions args (#10204)
Adds `req` to `filterOptions` arguments.
This commit is contained in:
@@ -156,6 +156,7 @@ called with an argument object with the following properties:
|
|||||||
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field |
|
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field |
|
||||||
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation |
|
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation |
|
||||||
| `user` | An object containing the currently authenticated user |
|
| `user` | An object containing the currently authenticated user |
|
||||||
|
| `req` | The Payload Request, which contains references to `payload`, `user`, `locale`, and more. |
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ called with an argument object with the following properties:
|
|||||||
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field |
|
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field |
|
||||||
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation |
|
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation |
|
||||||
| `user` | An object containing the currently authenticated user |
|
| `user` | An object containing the currently authenticated user |
|
||||||
|
| `req` | The Payload Request, which contains references to `payload`, `user`, `locale`, and more. |
|
||||||
|
|
||||||
### Example#filter-options-example
|
### Example#filter-options-example
|
||||||
|
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ export type FilterOptionsProps<TData = any> = {
|
|||||||
* The collection `slug` to filter against, limited to this field's `relationTo` property.
|
* The collection `slug` to filter against, limited to this field's `relationTo` property.
|
||||||
*/
|
*/
|
||||||
relationTo: CollectionSlug
|
relationTo: CollectionSlug
|
||||||
|
req: PayloadRequest
|
||||||
/**
|
/**
|
||||||
* An object containing document data that is scoped to only fields within the same parent of this field.
|
* An object containing document data that is scoped to only fields within the same parent of this field.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -525,6 +525,7 @@ const validateFilterOptions: Validate<
|
|||||||
id,
|
id,
|
||||||
data,
|
data,
|
||||||
relationTo: collection,
|
relationTo: collection,
|
||||||
|
req,
|
||||||
siblingData,
|
siblingData,
|
||||||
user,
|
user,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -532,6 +532,7 @@ export const addFieldStatePromise = async (args: AddFieldStatePromiseArgs): Prom
|
|||||||
id,
|
id,
|
||||||
data: fullData,
|
data: fullData,
|
||||||
relationTo: field.relationTo,
|
relationTo: field.relationTo,
|
||||||
|
req,
|
||||||
siblingData: data,
|
siblingData: data,
|
||||||
user: req.user,
|
user: req.user,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user