Skip to content

Commit

Permalink
[backend] First round fix (#4939)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-julien authored and Archidoit committed Dec 20, 2023
1 parent ab80b6e commit e55df92
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ const rebuildAndMergeInputFromExistingData = (rawInput, instance) => {
// const pointers = JSONPath({ json: instance, resultType: 'pointer', path: `${key}${object_path ?? ''}` });
// const patch = pointers.map((p) => ({ op: operation, path: p, value: extractSchemaDefFromPath(attributeDefinition, p, rawInput) }));
// const patchedInstance = jsonpatch.applyPatch(structuredClone(instance), patch).newDocument;
finalVal = value; // patchedInstance[key];
finalVal = R.path(`${key}${object_path ?? ''}`.split('.'), value);
} else { // Replace general
finalVal = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const HistoryDefinition: AttributeDefinition[] = [
{ name: 'connector_name', type: 'string', editDefault: false, mandatoryType: 'no', multiple: false, upsert: true },
{ name: 'marking_definition_ids', type: 'string', editDefault: false, mandatoryType: 'no', multiple: true, upsert: true },
{ name: 'object_marking_refs_ids', type: 'string', editDefault: false, mandatoryType: 'no', multiple: true, upsert: true },
{ name: 'from_id', type: 'string', editDefault: false, mandatoryType: 'no', multiple: false, upsert: true },
{ name: 'created_by_id', type: 'string', editDefault: false, mandatoryType: 'no', multiple: false, upsert: true },
{ name: 'created_by_ref_id', type: 'string', editDefault: false, mandatoryType: 'no', multiple: false, upsert: true },
{ name: 'creator_ids', type: 'string', editDefault: false, mandatoryType: 'no', multiple: true, upsert: true },
Expand Down
2 changes: 0 additions & 2 deletions opencti-platform/opencti-graphql/src/resolvers/stix.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { stixDelete, stixObjectMerge } from '../domain/stix';
import { batchLoader, stixLoadByIdStringify } from '../database/middleware';
import { connectorsForEnrichment } from '../database/repository';
import { batchCreators } from '../domain/user';
import { getSpecVersionOrDefault } from '../domain/stixRelationship';

const creatorsLoader = batchLoader(batchCreators);

Expand All @@ -27,7 +26,6 @@ const stixResolvers = {
return 'Unknown';
},
creators: (stix, _, context) => creatorsLoader.load(stix.creator_id, context, context.user),
spec_version: getSpecVersionOrDefault
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { addOrganizationRestriction, batchObjectOrganizations, removeOrganizatio
import { stixCoreObjectOptions } from '../schema/stixCoreObject';
import { numberOfContainersForObject } from '../domain/container';
import { paginatedForPathsWithEnrichment } from '../modules/internal/document/document-domain';
import { getSpecVersionOrDefault } from '../domain/stixRelationship';

const createdByLoader = batchLoader(batchCreatedBy);
const markingDefinitionsLoader = batchLoader(batchMarkingDefinitions);
Expand Down Expand Up @@ -127,6 +128,7 @@ const stixCoreObjectResolvers = {
return paginatedForPathsWithEnrichment(context, context.user, [`export/${stixCoreObject.entity_type}/${stixCoreObject.id}`], { first, entity_id: stixCoreObject.id });
},
numberOfConnectedElement: (stixCoreObject) => stixCoreObjectsConnectedNumber(stixCoreObject),
spec_version: getSpecVersionOrDefault
},
Mutation: {
stixCoreObjectEdit: (_, { id }, context) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import {
batchMarkingDefinitions,
findAll,
findById,
getSpecVersionOrDefault,
schemaRelationsTypesMapping,
stixRelationshipDelete,
stixRelationshipsDistribution,
stixRelationshipsMultiTimeSeries,
stixRelationshipsNumber,
stixRelationshipsNumber
} from '../domain/stixRelationship';
import { ABSTRACT_STIX_CORE_RELATIONSHIP, } from '../schema/general';
import { STIX_SIGHTING_RELATIONSHIP } from '../schema/stixSightingRelationship';
Expand Down Expand Up @@ -53,7 +54,8 @@ const stixRelationshipResolvers = {
}
/* v8 ignore next */
return 'Unknown';
}
},
spec_version: getSpecVersionOrDefault
},
Mutation: {
stixRelationshipEdit: (_, { id }, context) => ({
Expand Down

0 comments on commit e55df92

Please sign in to comment.