Skip to content

Commit

Permalink
[backend] Add status filter for Sightings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedae committed Jun 7, 2024
1 parent 60c0033 commit c1b730b
Showing 1 changed file with 13 additions and 30 deletions.
43 changes: 13 additions & 30 deletions opencti-platform/opencti-graphql/src/domain/filterKeysSchema.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
import { uniq } from 'ramda';
import { schemaAttributesDefinition } from '../schema/schema-attributes';
import { schemaTypesDefinition } from '../schema/schema-types';
import type {
AttributeDefinition,
ComplexAttributeWithMappings,
EnumAttribute,
IdAttribute,
NumericAttribute,
RefAttribute,
StringAttribute,
VocabAttribute
} from '../schema/attribute-definition';
import type { AttributeDefinition, ComplexAttributeWithMappings, EnumAttribute, IdAttribute, NumericAttribute, RefAttribute, StringAttribute, VocabAttribute, } from '../schema/attribute-definition';
import { schemaRelationsRefDefinition } from '../schema/schema-relationsRef';
import { isStixCoreObject } from '../schema/stixCoreObject';
import {
ALIAS_FILTER,
COMPUTED_RELIABILITY_FILTER,
CONNECTED_TO_INSTANCE_FILTER,
CONTEXT_CREATED_BY_FILTER,
CONTEXT_CREATOR_FILTER,
CONTEXT_ENTITY_ID_FILTER,
CONTEXT_ENTITY_TYPE_FILTER,
CONTEXT_OBJECT_LABEL_FILTER,
CONTEXT_OBJECT_MARKING_FILTER,
INSTANCE_REGARDING_OF,
MEMBERS_GROUP_FILTER,
MEMBERS_ORGANIZATION_FILTER,
MEMBERS_USER_FILTER,
OBJECT_CONTAINS_FILTER,
REPRESENTATIVE_FILTER,
TYPE_FILTER,
WORKFLOW_FILTER
} from '../utils/filtering/filtering-constants';
import { ALIAS_FILTER, COMPUTED_RELIABILITY_FILTER, CONNECTED_TO_INSTANCE_FILTER, CONTEXT_CREATED_BY_FILTER, CONTEXT_CREATOR_FILTER, CONTEXT_ENTITY_ID_FILTER, CONTEXT_ENTITY_TYPE_FILTER, CONTEXT_OBJECT_LABEL_FILTER, CONTEXT_OBJECT_MARKING_FILTER, INSTANCE_REGARDING_OF, MEMBERS_GROUP_FILTER, MEMBERS_ORGANIZATION_FILTER, MEMBERS_USER_FILTER, OBJECT_CONTAINS_FILTER, REPRESENTATIVE_FILTER, TYPE_FILTER, WORKFLOW_FILTER, } from '../utils/filtering/filtering-constants';
import { ABSTRACT_STIX_CORE_OBJECT, INPUT_GRANTED_REFS, isAbstract } from '../schema/general';
import { getEntityFromCache } from '../database/cache';
import type { BasicStoreSettings } from '../types/settings';
Expand All @@ -41,7 +14,7 @@ import { isEmptyField } from '../database/utils';
import { ENTITY_HASHED_OBSERVABLE_ARTIFACT } from '../schema/stixCyberObservable';
import { ENTITY_TYPE_IDENTITY_INDIVIDUAL, ENTITY_TYPE_IDENTITY_SECTOR, ENTITY_TYPE_IDENTITY_SYSTEM, isStixObjectAliased } from '../schema/stixDomainObject';
import { ENTITY_TYPE_MALWARE_ANALYSIS } from '../modules/malwareAnalysis/malwareAnalysis-types';
import { isBasicRelationship, isStixRelationship } from '../schema/stixRelationship';
import { isBasicRelationship, isStixRelationship, isStixRelationshipExceptRef } from '../schema/stixRelationship';
import { ENTITY_TYPE_LABEL, ENTITY_TYPE_MARKING_DEFINITION } from '../schema/stixMetaObject';
import { ENTITY_TYPE_IDENTITY_ORGANIZATION } from '../modules/organization/organization-types';

Expand Down Expand Up @@ -348,6 +321,16 @@ const completeFilterDefinitionMapWithSpecialKeys = (
elementsForFilterValuesSearch: [ENTITY_TYPE_IDENTITY_ORGANIZATION],
});
}
if (isStixRelationshipExceptRef(type)) {
filterDefinitionsMap.set(WORKFLOW_FILTER, {
filterKey: WORKFLOW_FILTER,
type: 'id',
label: 'Status',
multiple: false,
subEntityTypes,
elementsForFilterValuesSearch: [ENTITY_TYPE_STATUS_TEMPLATE],
});
}
};

const handleRemoveSpecialKeysFromFilterDefinitionsMap = (filterDefinitionsMap: Map<string, FilterDefinition>, type: string, isNotEnterpriseEdition: boolean) => {
Expand Down

0 comments on commit c1b730b

Please sign in to comment.