@amirmarmul/waba-common
Version:

30 lines (29 loc) • 805 B
TypeScript
import { Schema, Model } from 'mongoose';
export declare class CursorPaginationModel<T> {
meta: {
cursors?: {
next?: string | undefined;
previous?: string | undefined;
};
limit: number;
};
docs: T[];
}
export interface CursorPaginationOptions {
query?: any;
aggregate?: any;
populate?: any;
select?: any;
search?: {
value: string | undefined;
fields: string[] | undefined;
};
sort?: any;
projection?: any;
cursor?: string;
limit?: string;
}
export interface CursorPagination<T> extends Model<T> {
cursor(options?: CursorPaginationOptions, onError?: Function): Promise<CursorPaginationModel<T> | undefined>;
}
export declare function mongooseCursorPaginate<T>(schema: Schema<T>): void;