docs: add Query documentation (#9079)

- Replace remote query documentation with new Query documentation
- Add redirect from old remote query to new query documentation
- Update remote query usages across docs to use new query usage.
This commit is contained in:
Shahed Nasser
2024-09-10 15:31:47 +03:00
committed by GitHub
parent 1d8dd54014
commit e9b5f76f9a
31 changed files with 437 additions and 635 deletions

View File

@@ -29,7 +29,7 @@ export async function GET(
res: MedusaResponse
){
res.json({
message: "Hello, World!"
message: "Hello, World!",
})
}
```
@@ -58,7 +58,7 @@ medusaIntegrationTestRunner({
})
})
})
}
},
})
```
@@ -107,7 +107,7 @@ And consider that the file `src/api/store/custom/route.ts` defines another route
```ts title="src/api/store/custom/route.ts"
// other imports...
import HelloModuleService from "../../../modules/hello/service";
import HelloModuleService from "../../../modules/hello/service"
// ...
@@ -124,7 +124,7 @@ export async function POST(
)
res.json({
my_custom: myCustom
my_custom: myCustom,
})
}
```
@@ -155,7 +155,7 @@ medusaIntegrationTestRunner({
`/store/custom`,
{
id,
name: "Test"
name: "Test",
}
)
@@ -170,7 +170,7 @@ medusaIntegrationTestRunner({
})
})
})
}
},
})
```
@@ -210,7 +210,7 @@ medusaIntegrationTestRunner({
})
})
})
}
},
})
```
@@ -223,8 +223,8 @@ The `afterAll` hook resolves the `HelloModuleService` and use its `deleteMyCusto
Consider a `/store/custom/:id` API route created at `src/api/store/custom/[id]/route.ts`:
```ts title="src/api/store/custom/[id]/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa";
import HelloModuleService from "../../../modules/hello/service";
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import HelloModuleService from "../../../modules/hello/service"
export async function DELETE(
req: MedusaRequest,
@@ -237,7 +237,7 @@ export async function DELETE(
await helloModuleService.deleteMyCustoms(req.params.id)
res.json({
success: true
success: true,
})
}
```
@@ -266,7 +266,7 @@ medusaIntegrationTestRunner({
await helloModuleService.createMyCustoms({
id,
name: "Test"
name: "Test",
})
})
@@ -281,7 +281,7 @@ medusaIntegrationTestRunner({
})
})
})
}
},
})
```

View File

@@ -34,7 +34,7 @@ import { medusaIntegrationTestRunner } from "medusa-test-utils"
medusaIntegrationTestRunner({
testSuite: ({ api, getContainer }) => {
// TODO write tests...
}
},
})
```

View File

@@ -26,7 +26,7 @@ import {
createWorkflow,
createStep,
StepResponse,
WorkflowResponse
WorkflowResponse,
} from "@medusajs/workflows-sdk"
const step1 = createStep("step-1", () => {
@@ -59,7 +59,7 @@ medusaIntegrationTestRunner({
expect(result).toEqual("Hello, World!")
})
})
}
},
})
```

View File

@@ -56,7 +56,7 @@ moduleIntegrationTestRunner<HelloModuleService>({
expect(message).toEqual("Hello, World!")
})
})
}
},
})
```

View File

@@ -35,7 +35,7 @@ moduleIntegrationTestRunner<HelloModuleService>({
resolve: "./modules/hello",
testSuite: ({ service }) => {
// TODO write tests
}
},
})
```
@@ -88,7 +88,7 @@ import HelloModuleService from "../service"
moduleIntegrationTestRunner<HelloModuleService>({
moduleOptions: {
apiKey: "123"
apiKey: "123",
},
// ...
})
@@ -108,7 +108,7 @@ import HelloModuleService from "../service"
import { model } from "@medusajs/utils"
const DummyModel = model.define("dummy_model", {
id: model.id().primaryKey()
id: model.id().primaryKey(),
})
moduleIntegrationTestRunner<HelloModuleService>({

View File

@@ -41,8 +41,8 @@ npm install --save-dev jest @types/jest @swc/jest
Then, create the file `jest.config.js` with the following content:
```js title="jest.config.js"
const { loadEnv } = require('@medusajs/utils')
loadEnv('test', process.cwd())
const { loadEnv } = require("@medusajs/utils")
loadEnv("test", process.cwd())
module.exports = {
transform: {