mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 17:42:57 +00:00
feat: use config for MultiSearchRoute
This commit is contained in:
committed by
Rainer Killinger
parent
2b894bd1b6
commit
827827905b
@@ -14,6 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCConfigFile,
|
||||
SCMultiSearchRequest,
|
||||
SCMultiSearchResponse,
|
||||
SCMultiSearchRoute,
|
||||
@@ -32,11 +33,12 @@ export const multiSearchRouter = createRoute<SCMultiSearchResponse | SCTooManyRe
|
||||
multiSearchRouteModel,
|
||||
async (request: SCMultiSearchRequest, app) => {
|
||||
|
||||
const config: SCConfigFile = app.get('config');
|
||||
const bulkMemory: BulkStorage = app.get('bulk');
|
||||
const queryNames = Object.keys(request);
|
||||
|
||||
if (queryNames.length > 5) {
|
||||
return new SCTooManyRequestsErrorResponse(app.get('isProductiveEnvironment'));
|
||||
if (queryNames.length > config.backend.maxMultiSearchRouteQueries) {
|
||||
throw new SCTooManyRequestsErrorResponse(app.get('isProductiveEnvironment'));
|
||||
}
|
||||
|
||||
// get a map of promises for each query
|
||||
|
||||
Reference in New Issue
Block a user