@@ -15,7 +15,33 @@ export function BaseController<TEntity, TEntityDto>(
15
15
16
16
@Get ( )
17
17
@ApiOperation ( { summary : description } )
18
- @Paginated ( Entity , EntityDto )
18
+ @Paginated ( EntityDto , Entity )
19
+ async finManyByQuery ( @Query ( ) query : IQuery ) : Promise < TEntityDto > {
20
+ return this . service . findMany ( query ) ;
21
+ }
22
+
23
+ @Get ( ':movieId' )
24
+ @ApiOperation ( { summary : 'Поиск по movieId' } )
25
+ @Paginated ( EntityDto )
26
+ async findManyByMovieId ( @Param ( 'movieId' ) movieId : string ) : Promise < TEntityDto > {
27
+ return this . service . findMany ( { movieId } ) ;
28
+ }
29
+ }
30
+
31
+ return BaseController ;
32
+ }
33
+
34
+ export function BaseControllerWithFindById < TEntity , TEntityDto > (
35
+ Entity : Constructor < TEntity > ,
36
+ EntityDto : Constructor < TEntityDto > ,
37
+ description ?: string ,
38
+ ) {
39
+ abstract class BaseControllerWithFindById {
40
+ protected constructor ( readonly service : any ) { }
41
+
42
+ @Get ( )
43
+ @ApiOperation ( { summary : description } )
44
+ @Paginated ( EntityDto , Entity )
19
45
async finManyByQuery ( @Query ( ) query : IQuery ) : Promise < TEntityDto > {
20
46
return this . service . findMany ( query ) ;
21
47
}
@@ -28,5 +54,5 @@ export function BaseController<TEntity, TEntityDto>(
28
54
}
29
55
}
30
56
31
- return BaseController ;
57
+ return BaseControllerWithFindById ;
32
58
}
0 commit comments