bb-inspired
Version:
Core library for BB-inspired NestJS backend
23 lines (22 loc) • 677 B
TypeScript
import { Type } from '@nestjs/common';
export declare class PaginationParams {
page?: number;
limit?: number;
sortBy?: string;
sortDirection?: 'asc' | 'desc';
get offset(): number;
}
export interface PaginationMeta {
page: number;
limit: number;
total: number;
totalPages: number;
hasNextPage: boolean;
hasPreviousPage: boolean;
}
export declare class PaginatedResponse<T> {
items: T[];
meta: PaginationMeta;
constructor(items: T[], total: number, paginationParams: PaginationParams);
static create<T, V>(items: T[], total: number, paginationParams: PaginationParams, itemType?: Type<V>): PaginatedResponse<T | V>;
}