refactor: avoid duplicate/unneeded code (search for objects by UID)

Related to #70
This commit is contained in:
Jovan Krunić
2020-10-07 17:17:08 +02:00
committed by Rainer Killinger
parent e165837a15
commit 5ff16c1005
2 changed files with 39 additions and 75 deletions

View File

@@ -13,7 +13,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCThings, SCThingType} from '@openstapps/core';
import {SCThingType} from '@openstapps/core';
import {SCThing} from '@openstapps/core';
import {
ESAggMatchAllFilter,
@@ -30,7 +30,7 @@ import {NameList} from 'elasticsearch';
*/
interface Bucket {
/**
* Number of documents in the agregation bucket
* Number of documents in the aggregation bucket
*/
doc_count: number;
@@ -73,21 +73,6 @@ export function isBucketAggregation(agg: BucketAggregation | number): agg is Buc
return typeof agg !== 'number';
}
/**
* A response that contains info about whether the item exists plus the object itself
*/
export interface ItemExistsResponse {
/**
* Whether the item exists
*/
exists: boolean;
/**
* The object if it exists
*/
object?: ElasticsearchObject<SCThings>;
}
/**
* An aggregation that contains more aggregations nested inside
*/
@@ -183,7 +168,7 @@ export interface ElasticsearchQueryQueryStringConfig {
}
/**
* A hit in an elastiscsearch search result
* A hit in an elasticsearch search result
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/mapping-fields.html
*/
export interface ElasticsearchObject<T extends SCThing> {