docs: fixes to read-only links + add examples for filtering by relations (#13218)
This commit is contained in:
@@ -826,7 +826,7 @@ Next, use that token to register the customer:
|
||||
curl -X POST 'http://localhost:9000/store/customers' \
|
||||
--header 'Content-Type: application/json' \
|
||||
-H 'x-publishable-api-key: {api_key}' \
|
||||
--header 'Authorization Bearer {token}' \
|
||||
--header 'Authorization: Bearer {token}' \
|
||||
--data-raw '{
|
||||
"email": "customer@gmail.com"
|
||||
}'
|
||||
|
||||
@@ -137,6 +137,56 @@ const posts = await postModuleService.listPosts({
|
||||
|
||||
In the example above, only posts that have a publish date are retrieved.
|
||||
|
||||
--
|
||||
|
||||
## Filter by Relation's Property
|
||||
|
||||
Consider that your module also has an `Author` data model, and the `Post` data model has a relation to the `Author` data model.
|
||||
|
||||
To filter posts by a property of the `Author` data model, you can use nested objects.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const posts = await postModuleService.listPosts({
|
||||
author: {
|
||||
name: "John",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
In the example above, you retrieve posts whose `author` relation has a `name` property equal to `John`.
|
||||
|
||||
### Filter by Relation's Property Not Equal
|
||||
|
||||
```ts
|
||||
const posts = await postModuleService.listPosts({
|
||||
author: {
|
||||
name: {
|
||||
$or: [
|
||||
{
|
||||
name: {
|
||||
$eq: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: {
|
||||
$ne: "John",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
When you need to filter by a relationship property whose value doesn't match a specific condition, you must use an `$or` operator that applies the following conditions:
|
||||
|
||||
1. The relationship's property is not set. This is necessary to exclude posts that don't have an author.
|
||||
2. The relationship's property is not equal to the specific value.
|
||||
|
||||
So, in the example above, you retrieve posts either not having an author or having an author whose name is not "John".
|
||||
|
||||
---
|
||||
|
||||
## Apply Range Filters
|
||||
@@ -442,14 +492,6 @@ The following operators are supported by the service factory filtering mechanism
|
||||
Joins two or more conditions with a logical OR.
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
`$not`
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
Inverts the logic of a condition. For example, `$not: { $eq: value }` matches any value that is not equal to the specified value.
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
|
||||
@@ -300,10 +300,10 @@ In this example, you receive the `token` and `email` from the page's query param
|
||||
|
||||
Then, when the form that has the password field is submitted, you send a request to the [Reset Password API route](!api!/store#auth_postactor_typeauth_providerupdate), passing it the token, email, and new password.
|
||||
|
||||
Notice that the JS SDK passes the token in the `Authorization Bearer` header. So, if you're implementing this flow without using the JS SDK, make sure to pass the token accordingly.
|
||||
Notice that the JS SDK passes the token in the `Authorization: Bearer` header. So, if you're implementing this flow without using the JS SDK, make sure to pass the token accordingly.
|
||||
|
||||
<Note>
|
||||
|
||||
Before [Medusa v2.6](https://github.com/medusajs/medusa/releases/tag/v2.6), you passed the token as a query parameter. Now, you must pass it in the `Authorization Bearer` header.
|
||||
Before [Medusa v2.6](https://github.com/medusajs/medusa/releases/tag/v2.6), you passed the token as a query parameter. Now, you must pass it in the `Authorization: Bearer` header.
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -132,7 +132,7 @@ export const generatedEditDates = {
|
||||
"app/service-factory-reference/methods/retrieve/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/soft-delete/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/service-factory-reference/methods/update/page.mdx": "2025-07-31T08:24:03.685Z",
|
||||
"app/service-factory-reference/tips/filtering/page.mdx": "2025-04-23T14:38:29.068Z",
|
||||
"app/service-factory-reference/tips/filtering/page.mdx": "2025-08-15T12:06:28.709Z",
|
||||
"app/service-factory-reference/page.mdx": "2025-07-31T13:29:12.136Z",
|
||||
"app/storefront-development/cart/context/page.mdx": "2025-03-27T14:47:14.258Z",
|
||||
"app/storefront-development/cart/create/page.mdx": "2025-03-27T14:46:51.473Z",
|
||||
@@ -2099,7 +2099,7 @@ export const generatedEditDates = {
|
||||
"app/admin-components/layouts/two-column/page.mdx": "2025-08-01T15:18:00.109Z",
|
||||
"app/admin-components/components/forms/page.mdx": "2025-08-01T15:18:59.686Z",
|
||||
"app/commerce-modules/auth/reset-password/page.mdx": "2025-08-01T12:07:32.023Z",
|
||||
"app/storefront-development/customers/reset-password/page.mdx": "2025-03-27T14:46:51.424Z",
|
||||
"app/storefront-development/customers/reset-password/page.mdx": "2025-08-15T10:52:54.220Z",
|
||||
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2025-04-17T15:39:39.374Z",
|
||||
"app/commerce-modules/cart/extend/page.mdx": "2024-12-25T12:48:59.149Z",
|
||||
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2025-04-17T15:40:03.112Z",
|
||||
@@ -5832,7 +5832,7 @@ export const generatedEditDates = {
|
||||
"references/core_flows/types/core_flows.ThrowUnlessPaymentCollectionNotePaidInput/page.mdx": "2025-06-25T10:11:33.516Z",
|
||||
"references/core_flows/types/core_flows.ValidatePaymentsRefundStepInput/page.mdx": "2025-06-25T10:11:34.185Z",
|
||||
"references/core_flows/types/core_flows.ValidateRefundStepInput/page.mdx": "2025-06-25T10:11:34.177Z",
|
||||
"app/plugins/guides/wishlist/page.mdx": "2025-07-16T09:54:20.345Z",
|
||||
"app/plugins/guides/wishlist/page.mdx": "2025-08-15T10:52:37.465Z",
|
||||
"app/plugins/page.mdx": "2025-02-26T11:39:25.709Z",
|
||||
"app/admin-components/components/data-table/page.mdx": "2025-03-03T14:55:58.556Z",
|
||||
"references/order_models/variables/order_models.Order/page.mdx": "2025-08-14T12:59:55.945Z",
|
||||
|
||||
Reference in New Issue
Block a user