@inwink-mcp/backoffice-extension-helpers 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -20,4 +20,6 @@ POST {api}/{shardId}/{entity}/massdelete
|
|
|
20
20
|
|
|
21
21
|
Bulk DELETE, like `DELETE … WHERE` in SQL. Relies on a filter (see [query-language.md](./query-language.md#filters)).
|
|
22
22
|
|
|
23
|
+
Body `{ "filters": … }`. With `?direct=true`: runs in the call and returns `{ "deleted": n }`; without: returns `{ "taskId" }` (queued). Count first with the same filter (`count`).
|
|
24
|
+
|
|
23
25
|
> A deleted "With History" entity remains readable through `history/removed/query` (see [history.md](./history.md)).
|
|
@@ -30,3 +30,10 @@
|
|
|
30
30
|
| Massdelete | `POST {api}/{shardId}/{entity}/massdelete` | Bulk DELETE, like `DELETE … WHERE` in SQL — see [delete.md](./delete.md) |
|
|
31
31
|
| Export | | Returns entities as an Excel file |
|
|
32
32
|
| File | | File upload — see [files.md](./files.md) |
|
|
33
|
+
|
|
34
|
+
## Emails and push notifications (dedicated routes)
|
|
35
|
+
|
|
36
|
+
Email templates (`mailtemplate` on events, `communitymailtemplate` on communities) and scheduled email sends (`mailschedule` / `mailschedulecommunity`) are ordinary entities (create, update, delete, query). Sending and push notifications use dedicated routes. Filters (`expression`) have the same shape as `filters` in `query`. Sending reaches real people and cannot be undone: count first.
|
|
37
|
+
|
|
38
|
+
| Purpose | Pattern | Notes |
|
|
39
|
+
|
|
|
@@ -20,5 +20,36 @@ POST {api}/{shardId}/{entity}/import
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
- If an entity includes `id`, it is treated as an **update**.
|
|
23
|
-
- Without `id`, the `identifiers` map acts as a uniqueness constraint to decide create vs. update. Above, `mail` is used to match existing records.
|
|
24
|
-
- Much faster than individual create/edit calls.
|
|
23
|
+
- Without `id`, the `identifiers` map acts as a uniqueness constraint to decide create vs. update. Above, `mail` is used to match existing records (case-insensitive). Several matches → nothing is done for that row.
|
|
24
|
+
- Much faster than individual create/edit calls. Send batches of **200** rows (what the back-office does).
|
|
25
|
+
- `arrayMergeKeys` (optional, e.g. `["kinds"]`): array fields to **merge** with the existing values instead of replacing them.
|
|
26
|
+
- Synchronous: the response has one entry per input row, in the same order:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"entities": [
|
|
31
|
+
{ "entityId": "uuid", "modelErrors": [], "modelWarnings": [], "validationErrors": [] },
|
|
32
|
+
{ "entityIds": ["uuid1", "uuid2"], "modelErrors": [ { "property": "mail", "code": "required" } ] }
|
|
33
|
+
],
|
|
34
|
+
"exceptionMessage": null
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
A row without `entityId` was **not** written. `exceptionMessage` (top level or per row) reports a database error.
|
|
39
|
+
|
|
40
|
+
## Import preview (check without writing)
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
POST {api}/{shardId}/{entity}/import/preview
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Same body as the import (`selects` projects the matched record). Nothing is written. One entry per row:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{ "entities": [ { "entity": { "id": "uuid", "mail": "…" }, "entities": null, "modelErrors": [], "modelWarnings": [], "validationErrors": [] } ] }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- `entity` = the existing record that would be **updated**; `null` = the row would be **created**.
|
|
53
|
+
- `entities` with several items = ambiguous match (nothing would be done).
|
|
54
|
+
- Errors on fields the row did not send are only warnings on an update; on a create every mandatory field must be present.
|
|
55
|
+
- Run the preview, show the result to the user, then send the **same** body to `/import`.
|
|
@@ -33,4 +33,6 @@ POST {api}/{shardId}/{entity}/massupdate
|
|
|
33
33
|
|
|
34
34
|
Bulk EDIT, like `UPDATE … WHERE` in SQL. Relies on a filter (see [query-language.md](./query-language.md#filters)).
|
|
35
35
|
|
|
36
|
+
Body `{ "query": { "filters": … }, "input": { field: value } }`. With `?direct=true`: runs in the call and returns `{ "updated": n }`; without: returns `{ "taskId" }` (queued). Count first with the same filter (`count`).
|
|
37
|
+
|
|
36
38
|
> To update a batch of entities identified one by one, see also [import.md](./import.md).
|