File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
src/api-routes/onbase-docs Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,27 @@ const get = async (req, res) => {
112
112
[ , fbLb ] = result ;
113
113
114
114
// Get documents meta data by document IDs
115
- result = ! _ . isEmpty ( documentIds )
116
- ? await getDocumentsByIds ( token , fbLb , documentIds )
117
- : { items : [ ] } ;
115
+ let items = [ ] ;
116
+ let tempResult ;
117
+ const searchSize = 150 ;
118
+ const documentsLength = _ . size ( documentIds ) ;
119
+
120
+ for ( let i = 0 ; i < documentsLength ; i += searchSize ) {
121
+ /* eslint-disable no-await-in-loop */
122
+ tempResult = await getDocumentsByIds (
123
+ token ,
124
+ fbLb ,
125
+ _ . slice (
126
+ documentIds ,
127
+ i ,
128
+ i + searchSize > documentsLength ? documentsLength : i + searchSize ,
129
+ ) ,
130
+ ) ;
131
+ items = _ . concat ( items , tempResult . items ) ;
132
+ }
118
133
119
134
// Serialize documents
120
- const serializedDocuments = serializeDocuments ( result . items , query ) ;
135
+ const serializedDocuments = serializeDocuments ( items , query ) ;
121
136
122
137
return res . status ( 200 ) . send ( serializedDocuments ) ;
123
138
} ;
You can’t perform that action at this time.
0 commit comments