Skip to content

Commit

Permalink
Use create instead of update
Browse files Browse the repository at this point in the history
  • Loading branch information
aHenryJard committed Dec 30, 2024
1 parent 308b360 commit bb0bbc9
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions opencti-platform/opencti-graphql/src/manager/taskManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as R from 'ramda';
import { Promise as BluePromise } from 'bluebird';
import { ENTITY_TYPE_WORKSPACE } from '../modules/workspace/workspace-types';
import { ENTITY_TYPE_PUBLIC_DASHBOARD } from '../modules/publicDashboard/publicDashboard-types';
import { buildCreateEvent, lockResource, storeUpdateEvent } from '../database/redis';
import { buildCreateEvent, lockResource, storeCreateEntityEvent, storeUpdateEvent } from '../database/redis';
import {
ACTION_TYPE_ADD,
ACTION_TYPE_ENRICHMENT,
Expand Down Expand Up @@ -415,13 +415,10 @@ const executeShare = async (context, user, actionContext, element, containerId)
}
}
if (containerId) {
logApp.info('ANGIE - Need to push update on container', { containerId });
const objectStoreBase = await storeLoadByIdWithRefs(context, user, containerId);
logApp.info('ANGIE - storeObject', { objectStoreBase });
// FIXME what to update ??
const newObject = { ...objectStoreBase, description: objectStoreBase.description ? `${objectStoreBase.description}.` : '.' };
const message = `Updating share on parent ${containerId} after sharing all content.`;
await storeUpdateEvent(context, user, objectStoreBase, newObject, message, {});
// simulate a create event to update downstream openCTI
await storeCreateEntityEvent(context, user, objectStoreBase, message, {});
}
};
const executeUnshare = async (context, user, actionContext, element, containerId) => {
Expand All @@ -448,10 +445,8 @@ const executeUnshare = async (context, user, actionContext, element, containerId
if (containerId) {
logApp.info('ANGIE - Need to push update on container', { containerId });
const objectStoreBase = await storeLoadByIdWithRefs(context, user, containerId);
// FIXME what to update ??
const newObject = { ...objectStoreBase, description: objectStoreBase.description ? `${objectStoreBase.description}.` : '.' };
const message = `Updating share on parent ${containerId} after sharing all content.`;
await storeUpdateEvent(context, user, objectStoreBase, newObject, message, {});
const message = `Updating share on parent ${containerId} after unsharing all content.`;
await storeCreateEntityEvent(context, user, objectStoreBase, message, {});
}
};
const executeShareMultiple = async (context, user, actionContext, element) => {
Expand Down

0 comments on commit bb0bbc9

Please sign in to comment.