diff --git a/src/modules/catalog/catalog.service.ts b/src/modules/catalog/catalog.service.ts index 27c158f..5929849 100644 --- a/src/modules/catalog/catalog.service.ts +++ b/src/modules/catalog/catalog.service.ts @@ -238,71 +238,11 @@ class CatalogService implements OnModuleInit { metadata: Metadata, customer_id: string, ) { - this.logger.info('CatalogService - searchDataAssets', { query }); + this.logger.info('CatalogService - searchDataAssets'); const { search, page, size, sort_by, order, ...filters } = query; - - this.logger.debug('Extracted filters:', { filters }); - - - console.log('MAESTRO VAI CHAMAR PI-FACTORY COM:', { - search, page, size, sort_by, order, - filters: filters - }); - - - if (filters.owner) { - const { users: customer_users } = - await this.userService.findAllUsersByCustomerId(customer_id); - - this.logger.info('Available users in database count:', { count: customer_users.length }); - this.logger.info('First 5 users:', { - users: customer_users.slice(0, 5).map(u => ({ id: u.id, email: u.email, name: u.name })) - }); - - - const ownerValues = Array.isArray(filters.owner) - ? filters.owner - : (typeof filters.owner === 'string' && filters.owner.includes(',') - ? filters.owner.split(',').map((o: string) => o.trim()) - : [filters.owner]); - - this.logger.info('Owner values to convert:', { ownerValues, ownerFiltersOriginal: filters.owner }); - - - const ownerIds = ownerValues - .map((ownerValue: string) => { - const normalizedOwner = ownerValue.replace(/\s/g, '+'); - const user = customer_users.find(u => { - const isIdMatch = u.id === ownerValue; - const isEmailMatch = u.email === ownerValue || u.email === normalizedOwner; - const isNameMatch = u.name === ownerValue || u.name === normalizedOwner; - this.logger.info('Comparing:', { - userId: u.id, - userEmail: u.email, - userName: u.name, - filterValue: ownerValue, - normalizedFilter: normalizedOwner, - idMatch: isIdMatch, - emailMatch: isEmailMatch, - nameMatch: isNameMatch, - }); - return isIdMatch || isEmailMatch || isNameMatch; - }); - this.logger.info('Looking for owner result:', { ownerValue, found: !!user, userId: user?.id }); - return user?.id || ownerValue; - }) - .filter((id: string) => id); - - - if (ownerIds.length > 0) { - filters.owner = ownerIds; - } - } - - const { data_assets, total } = await lastValueFrom( this.catalogReadService.GetAllDataAssets( { @@ -318,11 +258,6 @@ class CatalogService implements OnModuleInit { ); - - console.log('MAESTRO RECEBEU RESPOSTA DO PI-FACTORY'); - - - const result = JSON.parse(data_assets);