chore(docs): added eslint to lint documentation code blocks (#2920)
* docs: added rule for code length * chore: fixes based on vale errors * changed to use eslint * fixes using eslint * added github action for documentation eslint * changed allowed max-length * fixed incorrect heading level * removed comment
This commit is contained in:
1 parent
99add15fc3
commit
d1b4b11ff6
67 files changed
+2611
-1735
No files matched your search
@@ -38,23 +38,25 @@ To create a scheduled job, add the following code in the file you created, which
|
||||
|
||||
```ts title=src/loaders/publish.ts
|
||||
const publishJob = async (container, options) => {
|
||||
const jobSchedulerService = container.resolve("jobSchedulerService");
|
||||
jobSchedulerService.create("publish-products", {}, "0 0 * * *", async () => {
|
||||
//job to execute
|
||||
const productService = container.resolve("productService");
|
||||
const draftProducts = await productService.list({
|
||||
status: 'draft'
|
||||
});
|
||||
const jobSchedulerService = container.resolve("jobSchedulerService")
|
||||
jobSchedulerService.create("publish-products", {}, "0 0 * * *",
|
||||
async () => {
|
||||
// job to execute
|
||||
const productService = container.resolve("productService")
|
||||
const draftProducts = await productService.list({
|
||||
status: "draft",
|
||||
})
|
||||
|
||||
for (const product of draftProducts) {
|
||||
await productService.update(product.id, {
|
||||
status: 'published'
|
||||
});
|
||||
for (const product of draftProducts) {
|
||||
await productService.update(product.id, {
|
||||
status: "published",
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export default publishJob;
|
||||
export default publishJob
|
||||
```
|
||||
|
||||
:::info
|
||||
@@ -87,12 +89,12 @@ For example:
|
||||
```ts
|
||||
jobSchedulerService.create("publish-products", {
|
||||
data: {
|
||||
productId
|
||||
}
|
||||
productId,
|
||||
},
|
||||
}, "0 0 * * *", async (job) => {
|
||||
console.log(job.data); // {productId: 'prod_124...'}
|
||||
//...
|
||||
});
|
||||
console.log(job.data) // {productId: 'prod_124...'}
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in new issue
Block a user