11import { Type } from '@nestjs/common' ;
2- import { Field , ObjectType } from '@nestjs/graphql' ;
2+ import { Directive , Field , ObjectType } from '@nestjs/graphql' ;
33import { PageInfo } from './page-info.model' ;
44
55interface IEdgeType < TItem > {
@@ -19,14 +19,13 @@ export function Paginated<TItem>(
1919 description : `A ${ classRef . name } edge.` ,
2020 } )
2121 abstract class EdgeType {
22- @Field ( ( ) => String , {
23- description : 'A cursor for use in pagination.' ,
24- } )
22+ @Field ( ( ) => String , { description : 'A cursor for use in pagination.' } )
2523 cursor : string ;
2624
2725 @Field ( ( ) => classRef , {
2826 description : `The item at the end of ${ classRef . name } Edge.` ,
2927 } )
28+ @Directive ( `@cacheControl(inheritMaxAge: true)` )
3029 node : TItem ;
3130 }
3231
@@ -37,11 +36,11 @@ export function Paginated<TItem>(
3736 } )
3837 abstract class PaginatedType implements IPaginatedType < TItem > {
3938 @Field ( ( ) => [ EdgeType ] , { nullable : true , description : 'A list of edges' } )
39+ @Directive ( `@cacheControl(inheritMaxAge: true)` )
4040 edges : EdgeType [ ] ;
4141
42- @Field ( ( ) => PageInfo , {
43- description : 'Information to aid in pagination.' ,
44- } )
42+ @Field ( ( ) => PageInfo , { description : 'Information to aid in pagination.' } )
43+ @Directive ( `@cacheControl(inheritMaxAge: true)` )
4544 pageInfo : PageInfo ;
4645 }
4746 return PaginatedType as Type < IPaginatedType < TItem > > ;
0 commit comments