@@ -319,22 +319,30 @@ class IntegrationRepository {
319319 * @param {string } [filters.query=''] - The search query to filter integrations.
320320 * @param {number } [filters.limit=20] - The maximum number of integrations to return.
321321 * @param {number } [filters.offset=0] - The offset for pagination.
322+ * @param {string } [filters.segment=null] - The segment to filter integrations by.
322323 * @param {IRepositoryOptions } options - The repository options for querying.
323324 * @returns {Promise<Object> } The result containing the rows of integrations and metadata about the query.
324325 */
325326 static async findGlobalIntegrations (
326- { platform = null , status = [ 'done' ] , query = '' , limit = 20 , offset = 0 } ,
327+ { platform = null , status = [ 'done' ] , query = '' , limit = 20 , offset = 0 , segment = null } ,
327328 options : IRepositoryOptions ,
328329 ) {
329330 const qx = SequelizeRepository . getQueryExecutor ( options )
330331 if ( status . includes ( 'not-connected' ) ) {
331- const rows = await fetchGlobalNotConnectedIntegrations ( qx , platform , query , limit , offset )
332- const [ result ] = await fetchGlobalNotConnectedIntegrationsCount ( qx , platform , query )
332+ const rows = await fetchGlobalNotConnectedIntegrations (
333+ qx ,
334+ platform ,
335+ query ,
336+ limit ,
337+ offset ,
338+ segment ,
339+ )
340+ const [ result ] = await fetchGlobalNotConnectedIntegrationsCount ( qx , platform , query , segment )
333341 return { rows, count : + result . count , limit : + limit , offset : + offset }
334342 }
335343
336- const rows = await fetchGlobalIntegrations ( qx , status , platform , query , limit , offset )
337- const [ result ] = await fetchGlobalIntegrationsCount ( qx , status , platform , query )
344+ const rows = await fetchGlobalIntegrations ( qx , status , platform , query , limit , offset , segment )
345+ const [ result ] = await fetchGlobalIntegrationsCount ( qx , status , platform , query , segment )
338346 return { rows, count : + result . count , limit : + limit , offset : + offset }
339347 }
340348
@@ -344,13 +352,17 @@ class IntegrationRepository {
344352 *
345353 * @param {Object } param1 - The optional parameters.
346354 * @param {string|null } [param1.platform=null] - The platform to filter the integrations. Default is null.
355+ * @param {string|null } [param1.segment=null] - The segment to filter the integrations. Default is null.
347356 * @param {IRepositoryOptions } options - The options for the repository operations.
348357 * @return {Promise<Array<Object>> } A promise that resolves to an array of objects containing the statuses and their counts.
349358 */
350- static async findGlobalIntegrationsStatusCount ( { platform = null } , options : IRepositoryOptions ) {
359+ static async findGlobalIntegrationsStatusCount (
360+ { platform = null , segment = null } ,
361+ options : IRepositoryOptions ,
362+ ) {
351363 const qx = SequelizeRepository . getQueryExecutor ( options )
352- const [ result ] = await fetchGlobalNotConnectedIntegrationsCount ( qx , platform , '' )
353- const rows = await fetchGlobalIntegrationsStatusCount ( qx , platform )
364+ const [ result ] = await fetchGlobalNotConnectedIntegrationsCount ( qx , platform , '' , segment )
365+ const rows = await fetchGlobalIntegrationsStatusCount ( qx , platform , segment )
354366 return [ ...rows , { status : 'not-connected' , count : + result . count } ]
355367 }
356368
0 commit comments