Skip to main content
100%

A Generic Paginated Type for GraphQL in NestJS code first approach

✓ Published0🌍 Public
Aackuser
Last edited Jan 21, 2022
Created on May 3, 2023

This example demonstrates a generic paginated type for GraphQL APIs using a NestJS code-first approach. It shows how to define reusable interfaces and classes for cursor-based pagination, including edge, page info, and paginated response structures. The code uses `@ObjectType`, `@Field`, and `@ArgsType` decorators from `@nestjs/graphql`, along with `class-validator` decorators like `@IsBase64` and `@Max` for input validation. A `PaginationService` handles encoding and decoding cursors with Buffer base64 conversion and implements the pagination logic for entity arrays.

AI-generated description

Similar vizzes