Skip to content

Commit 35b5c71

Browse files
committed
Update project.js
1 parent 2ca3168 commit 35b5c71

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/resolvers/project.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const ProjectModel = require('../models/project').default;
1111
const EVENTS_GROUP_HASH_INDEX_NAME = 'groupHashUnique';
1212
const REPETITIONS_GROUP_HASH_INDEX_NAME = 'groupHash_hashed';
1313
const REPETITIONS_USER_ID_INDEX_NAME = 'userId';
14+
const MAX_SEARCH_QUERY_LENGTH = 50;
1415

1516
/**
1617
* See all types and fields here {@see ../typeDefs/project.graphql}
@@ -310,8 +311,8 @@ module.exports = {
310311
*/
311312
async recentEvents(project, { limit, skip, sort, filters, search }) {
312313
if (search) {
313-
if (search.length > 100) {
314-
throw new UserInputError('Search query is too long. Maximum length is 100 characters');
314+
if (search.length > MAX_SEARCH_QUERY_LENGTH) {
315+
search = search.slice(0, MAX_SEARCH_QUERY_LENGTH);
315316
}
316317
}
317318

0 commit comments

Comments
 (0)