mirror of
https://github.com/directus/directus.git
synced 2026-01-24 13:28:15 -05:00
Emit item crud
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
} from '../types';
|
||||
import Knex from 'knex';
|
||||
import cache from '../cache';
|
||||
import emitter from '../emitter';
|
||||
|
||||
import PayloadService from './payload';
|
||||
import AuthorizationService from './authorization';
|
||||
@@ -150,6 +151,13 @@ export default class ItemsService implements AbstractService {
|
||||
await cache.clear();
|
||||
}
|
||||
|
||||
emitter.emitAsync(`item.create.${this.collection}`, {
|
||||
collection: this.collection,
|
||||
item: primaryKeys,
|
||||
action: 'create',
|
||||
payload: payloads,
|
||||
});
|
||||
|
||||
return primaryKeys;
|
||||
});
|
||||
|
||||
@@ -311,6 +319,13 @@ export default class ItemsService implements AbstractService {
|
||||
await cache.clear();
|
||||
}
|
||||
|
||||
emitter.emitAsync(`item.update.${this.collection}`, {
|
||||
collection: this.collection,
|
||||
item: key,
|
||||
action: 'update',
|
||||
payload,
|
||||
});
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -373,6 +388,12 @@ export default class ItemsService implements AbstractService {
|
||||
await cache.clear();
|
||||
}
|
||||
|
||||
emitter.emitAsync(`item.delete.${this.collection}`, {
|
||||
collection: this.collection,
|
||||
item: key,
|
||||
action: 'delete',
|
||||
});
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user