import { PaginateResult } from 'mongoose' ; import { Pagination } from '~/shared/interface/paginator.interface' ; export function transformDataToPaginate < T = any > ( data ) { return { data : data . docs , pagination : { total : data . totalDocs , currentPage : data . page as number , totalPage : data . totalPages as number , size : data . limit , hasNextPage : data . hasNextPage , hasPrevPage : data . hasPrevPage , } , } ; }