mirror of
https://github.com/directus/directus.git
synced 2026-01-24 08:58:11 -05:00
Fix Emit Events for item CRUD operations in Flows (#14741)
This commit is contained in:
@@ -42,7 +42,7 @@ export default defineOperationApi<Options>({
|
||||
if (!payloadObject) {
|
||||
result = null;
|
||||
} else {
|
||||
result = await itemsService.createMany(toArray(payloadObject), { emitEvents });
|
||||
result = await itemsService.createMany(toArray(payloadObject), { emitEvents: !!emitEvents });
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -47,9 +47,9 @@ export default defineOperationApi<Options>({
|
||||
const keys = toArray(key);
|
||||
|
||||
if (keys.length === 1) {
|
||||
result = await itemsService.deleteOne(keys[0], { emitEvents });
|
||||
result = await itemsService.deleteOne(keys[0], { emitEvents: !!emitEvents });
|
||||
} else {
|
||||
result = await itemsService.deleteMany(keys, { emitEvents });
|
||||
result = await itemsService.deleteMany(keys, { emitEvents: !!emitEvents });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ export default defineOperationApi<Options>({
|
||||
const keys = toArray(key);
|
||||
|
||||
if (keys.length === 1) {
|
||||
result = await itemsService.readOne(keys[0], sanitizedQueryObject, { emitEvents });
|
||||
result = await itemsService.readOne(keys[0], sanitizedQueryObject, { emitEvents: !!emitEvents });
|
||||
} else {
|
||||
result = await itemsService.readMany(keys, sanitizedQueryObject, { emitEvents });
|
||||
result = await itemsService.readMany(keys, sanitizedQueryObject, { emitEvents: !!emitEvents });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,14 +53,14 @@ export default defineOperationApi<Options>({
|
||||
let result: PrimaryKey | PrimaryKey[] | null;
|
||||
|
||||
if (!key || (Array.isArray(key) && key.length === 0)) {
|
||||
result = await itemsService.updateByQuery(sanitizedQueryObject, payloadObject, { emitEvents });
|
||||
result = await itemsService.updateByQuery(sanitizedQueryObject, payloadObject, { emitEvents: !!emitEvents });
|
||||
} else {
|
||||
const keys = toArray(key);
|
||||
|
||||
if (keys.length === 1) {
|
||||
result = await itemsService.updateOne(keys[0], payloadObject, { emitEvents });
|
||||
result = await itemsService.updateOne(keys[0], payloadObject, { emitEvents: !!emitEvents });
|
||||
} else {
|
||||
result = await itemsService.updateMany(keys, payloadObject, { emitEvents });
|
||||
result = await itemsService.updateMany(keys, payloadObject, { emitEvents: !!emitEvents });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user