@@ -20,7 +20,12 @@ export class AgntcyController {
2020 // Validators
2121 public static recordPublishValidator = [
2222 check ( 'data' ) . exists ( ) . withMessage ( 'data field is required' ) . bail ( ) ,
23- check ( 'data.name' ) . exists ( ) . withMessage ( 'name is required' ) . isString ( ) . withMessage ( 'name must be a string' ) . bail ( ) ,
23+ check ( 'data.name' )
24+ . exists ( )
25+ . withMessage ( 'name is required' )
26+ . isString ( )
27+ . withMessage ( 'name must be a string' )
28+ . bail ( ) ,
2429 check ( 'data.version' )
2530 . exists ( )
2631 . withMessage ( 'version is required' )
@@ -62,11 +67,7 @@ export class AgntcyController {
6267 . withMessage ( 'Invalid record type' )
6368 . bail ( ) ,
6469 query ( 'page' ) . optional ( ) . isInt ( { min : 1 } ) . withMessage ( 'page must be a positive integer' ) . bail ( ) ,
65- query ( 'limit' )
66- . optional ( )
67- . isInt ( { min : 1 , max : 100 } )
68- . withMessage ( 'limit must be between 1 and 100' )
69- . bail ( ) ,
70+ query ( 'limit' ) . optional ( ) . isInt ( { min : 1 , max : 100 } ) . withMessage ( 'limit must be between 1 and 100' ) . bail ( ) ,
7071 ] ;
7172
7273 public static recordGetValidator = [
@@ -263,12 +264,10 @@ export class AgntcyController {
263264
264265 try {
265266 // Set defaults for pagination
266- const { page = 1 , limit = 20 } = request . query as SearchRecordQuery ;
267+ const { page = 1 , limit = 20 } = request . query as SearchRecordQuery ;
267268
268269 // Search directory
269- const results = await agntcyService . search (
270- response . locals . customer ,
271- {
270+ const results = await agntcyService . search ( response . locals . customer , {
272271 ...query ,
273272 page,
274273 limit,
@@ -284,7 +283,6 @@ export class AgntcyController {
284283 total : results . total ,
285284 total_pages : Math . ceil ( results . total / limit ) ,
286285 } ,
287- filters_applied : this . getAppliedFilters ( query ) ,
288286 } satisfies SearchRecordResponseBody ) ;
289287 } catch ( error ) {
290288 return response . status ( StatusCodes . INTERNAL_SERVER_ERROR ) . json ( {
@@ -388,22 +386,4 @@ export class AgntcyController {
388386 } satisfies UnsuccessfulGetRecordResponseBody ) ;
389387 }
390388 }
391-
392- /**
393- * Helper method to extract applied filters from query
394- */
395- private getAppliedFilters ( query : SearchRecordQuery ) : Record < string , any > {
396- const filters : Record < string , any > = { } ;
397-
398- if ( query . name ) filters . name = query . name ;
399- if ( query . version ) filters . version = query . version ;
400- if ( query . skill ) filters . skill = query . skill ;
401- if ( query . skill_id ) filters . skill_id = query . skill_id ;
402- if ( query . domain ) filters . domain = query . domain ;
403- if ( query . locator ) filters . locator = query . locator ;
404- if ( query . module ) filters . module = query . module ;
405- if ( query . type ) filters . type = query . type ;
406-
407- return filters ;
408- }
409- }
389+ }
0 commit comments