UNPKG

@amirmarmul/waba-common

Version:

![GitHub release](https://img.shields.io/github/v/release/amirmarmul/waba-common?style=flat-square)

32 lines (31 loc) 918 B
import { Schema, Model } from 'mongoose'; interface PaginationMeta { limit: number | undefined; offset: number | undefined; total: number | undefined; } export declare class PaginationModel<T> { meta: PaginationMeta; docs: T[]; } export interface PaginationOptions { query?: any | undefined; aggregate?: any | undefined; populate?: any | undefined; select?: any | undefined; search?: { value: string | undefined; fields: string[] | undefined; }; sort?: any | undefined; projection?: any | undefined; page?: { limit?: any | undefined; offset?: any | undefined; }; } export interface Pagination<T> extends Model<T> { paginate(options?: PaginationOptions | undefined, onError?: Function | undefined): Promise<PaginationModel<T> | undefined>; } export declare function mongoosePaginate<T>(schema: Schema<T>): void; export {};