@@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
22import { db } from '@db' ;
33import { getManifest } from '@trycompai/integration-platform' ;
44
5- const CLOUD_PROVIDER_CATEGORY = 'Cloud' ;
5+ const CLOUD_PROVIDER_SLUGS = [ 'aws' , 'gcp' , 'azure' ] as const ;
66
77/** Scan window for filtering legacy results to latest scan only */
88const SCAN_WINDOW_MS = 10 * 60 * 1000 ; // 10 minutes
@@ -88,7 +88,7 @@ export class CloudSecurityQueryService {
8888 where : {
8989 organizationId,
9090 status : 'active' ,
91- provider : { category : CLOUD_PROVIDER_CATEGORY } ,
91+ provider : { slug : { in : [ ... CLOUD_PROVIDER_SLUGS ] } } ,
9292 } ,
9393 include : { provider : true } ,
9494 } ) ;
@@ -98,10 +98,9 @@ export class CloudSecurityQueryService {
9898 where : { organizationId } ,
9999 } ) ;
100100
101- const activeLegacy = legacyIntegrations . filter ( ( i ) => {
102- const manifest = getManifest ( i . integrationId ) ;
103- return manifest ?. category === CLOUD_PROVIDER_CATEGORY ;
104- } ) ;
101+ const activeLegacy = legacyIntegrations . filter ( ( i ) =>
102+ ( CLOUD_PROVIDER_SLUGS as readonly string [ ] ) . includes ( i . integrationId ) ,
103+ ) ;
105104
106105 // Map new connections
107106 const newProviders : CloudProvider [ ] = newConnections . map ( ( conn ) => {
@@ -207,7 +206,7 @@ export class CloudSecurityQueryService {
207206 where : {
208207 organizationId,
209208 status : 'active' ,
210- provider : { category : CLOUD_PROVIDER_CATEGORY } ,
209+ provider : { slug : { in : [ ... CLOUD_PROVIDER_SLUGS ] } } ,
211210 } ,
212211 include : { provider : true } ,
213212 } ) ;
@@ -303,10 +302,9 @@ export class CloudSecurityQueryService {
303302 where : { organizationId } ,
304303 } ) ;
305304
306- const activeLegacy = legacyIntegrations . filter ( ( i ) => {
307- const manifest = getManifest ( i . integrationId ) ;
308- return manifest ?. category === CLOUD_PROVIDER_CATEGORY ;
309- } ) ;
305+ const activeLegacy = legacyIntegrations . filter ( ( i ) =>
306+ ( CLOUD_PROVIDER_SLUGS as readonly string [ ] ) . includes ( i . integrationId ) ,
307+ ) ;
310308
311309 const legacyIds = activeLegacy . map ( ( i ) => i . id ) ;
312310 if ( legacyIds . length === 0 ) return [ ] ;
0 commit comments