refactor: use the SCMap more consistently

This commit is contained in:
Michel Jonathan Schmitz
2019-02-20 11:04:55 +01:00
parent a0ab72e597
commit 8f66abbb73
6 changed files with 20 additions and 40 deletions

2
package-lock.json generated
View File

@@ -1969,7 +1969,7 @@
"dependencies": { "dependencies": {
"minimist": { "minimist": {
"version": "0.0.10", "version": "0.0.10",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
"dev": true "dev": true
} }

View File

@@ -13,6 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route'; import {SCAbstractRoute, SCRouteHttpVerbs} from '../../../Route';
import {SCMap} from '../../../types/Map';
import { import {
SCInternalServerErrorResponse, SCInternalServerErrorResponse,
SCMethodNotAllowedErrorResponse, SCMethodNotAllowedErrorResponse,
@@ -33,9 +34,7 @@ import {SCSearchQuery} from './SearchRequest';
* *
* @validatable * @validatable
*/ */
export interface SCMultiSearchRequest { export type SCMultiSearchRequest = SCMap<SCSearchQuery>;
[k: string]: SCSearchQuery;
}
/** /**
* Route for submission of multiple search requests at once * Route for submission of multiple search requests at once

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018 StApps * Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMap} from '../../../types/Map';
import {SCSearchResult} from './SearchResponse'; import {SCSearchResult} from './SearchResponse';
/** /**
@@ -21,6 +22,4 @@ import {SCSearchResult} from './SearchResponse';
* *
* @validatable * @validatable
*/ */
export interface SCMultiSearchResponse { export type SCMultiSearchResponse = SCMap<SCSearchResult>;
[k: string]: SCSearchResult;
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018 StApps * Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -79,19 +79,6 @@ export interface SCBackendConfigurationSortableField {
} }
/**
* Values of a field that should be boosted by the given factors
*/
export interface SCBackendConfigurationSearchBoostingValues {
/**
* Value of the field that should be boosted by the given number
*
* For example `"SS 2019": 2`
*/
[valueOfField: string]: number;
}
/** /**
* A boosting configuration for one SCType * A boosting configuration for one SCType
*/ */
@@ -103,11 +90,15 @@ export interface SCBackendConfigurationSearchBoosting {
factor: number; factor: number;
/** /**
* Outer-Map:
* Fields of this type that should be boosted if they match a given value * Fields of this type that should be boosted if they match a given value
*
* For nest fields you can use the `.` as a separator. For example `academicTerms.acronym` * For nest fields you can use the `.` as a separator. For example `academicTerms.acronym`
*
* Inner-map:
* Value of the field that should be boosted by the given number
* For example `"SS 2019": 2`
*/ */
fields?: SCMap<SCBackendConfigurationSearchBoostingValues>; fields?: SCMap<SCMap<number>>;
/** /**
* Type of things the factor should be applied to * Type of things the factor should be applied to
@@ -163,14 +154,10 @@ export interface SCBackendInternalConfiguration {
/** /**
* Configuration of the database * Configuration of the database
*/ */
export interface SCBackendConfigurationDatabaseConfiguration { export interface SCBackendConfigurationDatabaseConfiguration extends SCMap<any> {
/** /**
* Name of the database used by the backend * Name of the database used by the backend
*/ */
name: string; name: string;
/**
* Allow additional configuration for the database
*/
[key: string]: any;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018 StApps * Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCMap} from '../Map';
/** /**
* All available filter types * All available filter types
*/ */
@@ -47,9 +48,7 @@ export interface SCSearchAbstractFilter<T extends SCSearchAbstractFilterArgument
/** /**
* Arguments for the filter instruction * Arguments for the filter instruction
*/ */
export interface SCSearchAbstractFilterArguments { export type SCSearchAbstractFilterArguments = SCMap<any>;
[key: string]: any;
}
/** /**
* Available filter instructions * Available filter instructions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018 StApps * Copyright (C) 2018-2019 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -13,6 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {SCThingsField} from '../../Classes'; import {SCThingsField} from '../../Classes';
import {SCMap} from '../Map';
import {SCDistanceSort} from './Distance'; import {SCDistanceSort} from './Distance';
import {SCDucetSort} from './Ducet'; import {SCDucetSort} from './Ducet';
import {SCPriceSort} from './Price'; import {SCPriceSort} from './Price';
@@ -40,12 +41,7 @@ export interface SCSearchAbstractSort<T extends SCSearchAbstractSortArguments> {
/** /**
* Map of arguments for the sort instruction * Map of arguments for the sort instruction
*/ */
export interface SCSearchAbstractSortArguments { export interface SCSearchAbstractSortArguments extends SCMap<any> {
/**
* Index signature for additional arguments
*/
[key: string]: any;
/** /**
* Field to sort by * Field to sort by
*/ */