mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Merge branch 'main' into insights
This commit is contained in:
@@ -74,6 +74,7 @@ module.exports = function registerHook({ exceptions }) {
|
||||
|
||||
| Scope | Actions | Before |
|
||||
| ------------------------------- | ----------------------------------------------------------- | ---------------- |
|
||||
| `cron()` | [See below for configuration](#interval-cron) | No |
|
||||
| `server` | `start` and `stop` | Optional |
|
||||
| `init` | | Optional |
|
||||
| `routes.init` | `before` and `after` | No |
|
||||
@@ -103,6 +104,22 @@ module.exports = function registerHook({ exceptions }) {
|
||||
<sup>2</sup> oAuth provider name can replaced with wildcard for any oauth providers `oauth.*.login`\
|
||||
<sup>3</sup> Doesn't support `.before` modifier
|
||||
|
||||
#### Interval (cron)
|
||||
|
||||
Hooks support running on an interval through [`node-cron`](https://www.npmjs.com/package/node-cron). To set this up,
|
||||
provide a cron statement in the event scope as follows: `cron(<statement>)`, for example `cron(15 14 1 * *)` (at 14:15
|
||||
on day-of-month 1) or `cron(5 4 * * sun)` (at 04:05 on Sunday). See example below:
|
||||
|
||||
```js
|
||||
module.exports = function registerHook() {
|
||||
return {
|
||||
'cron(*/15 * * * *)': async function () {
|
||||
await axios.post('http://example.com/webhook', { message: 'Another 15 minutes passed...' });
|
||||
},
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
## 3. Register your Hook
|
||||
|
||||
Each custom hook is registered to its event scope using a function with the following format:
|
||||
|
||||
@@ -94,7 +94,7 @@ To configure manual sorting for a collection:
|
||||
|
||||
1. Navigate to **Settings > Data Model > [Collection Name]**
|
||||
2. Create a field with the **Integer** type
|
||||
* Optional: Set the field to be **Hidden**
|
||||
- Optional: Set the field to be **Hidden**
|
||||
3. Select the field you just created in the **Sort Field** dropdown
|
||||
|
||||
::: tip Automatic Setup
|
||||
@@ -106,7 +106,8 @@ field, the collection's sort settings will automatically be configured for you.
|
||||
|
||||
::: tip Interface Sorting
|
||||
|
||||
To configure manual sorting within an Interface (eg: M2M, O2M, or M2A), configure as above, but also set the **Sort Field** on the field's Relationship pane.
|
||||
To configure manual sorting within an Interface (eg: M2M, O2M, or M2A), configure as above, but also set the **Sort
|
||||
Field** on the field's Relationship pane.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ There are two ways to migrate from an existing Directus 8.X instance:
|
||||
- [Automated Script](#automated-script) (recommended)
|
||||
- [Manual Database Export/Import](#manual-database-export-import)
|
||||
|
||||
Be sure to check the [Breaking changes](#breaking-changes) if you are consuming the API from an application.
|
||||
|
||||
## Automated Script
|
||||
|
||||
We created a (community maintained) script, that will automatically copy over the schema, content, files, users, and
|
||||
@@ -64,3 +66,9 @@ Once the tables are in, you can start configuring the details of the schema. Thi
|
||||
interfaces, displays, and their options for your fields.
|
||||
|
||||
This would also be a good time to reconfigure your permissions, to ensure they are accurate.
|
||||
|
||||
## Breaking changes
|
||||
|
||||
- [Filter operators](/reference/filter-rules.md) have changed, now they are preceeded with an underscore eg:
|
||||
`/items/users?filter[comments.thread.title][like]=Directus` is now
|
||||
`/items/users?filter[comments][thread][title][_like]=Directus`
|
||||
|
||||
@@ -67,7 +67,7 @@ See [Creating a Thumbnail Preset](/guides/files/#creating-a-thumbnail-preset)
|
||||
|
||||
See [Styles > Custom CSS](/guides/styles/#custom-css)
|
||||
|
||||
## Upgrading a Project
|
||||
## Upgrading / Updating a Project
|
||||
|
||||
1. Backup your project
|
||||
2. Run `npm update`
|
||||
|
||||
Reference in New Issue
Block a user