# sequelize-typescript-paginate

> Sequelize Model with pagination for Sequelize-Typescript

Latest version **1.1.0** (published 2020-12-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install sequelize-typescript-paginate
pnpm add sequelize-typescript-paginate
yarn add sequelize-typescript-paginate
bun add sequelize-typescript-paginate
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-12-31 |
| First published | 2020-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Mariano Zunino |
| Maintainers | mzunino |
| Keywords | sequelize, typescript, paginate |

## Links

- npm: https://www.npmjs.com/package/sequelize-typescript-paginate
- Repository: https://github.com/marianozunino/sequelize-typescript-paginate
- Homepage: https://github.com/marianozunino/sequelize-typescript-paginate#readme
- Issues: https://github.com/marianozunino/sequelize-typescript-paginate/issues
- npm.io page: https://npm.io/package/sequelize-typescript-paginate

## Dependencies (1)

- [sequelize-typescript](https://npm.io/package/sequelize-typescript.md) 1.1.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-12-31
- 1.0.0 — 2020-12-30

## README

# sequelize-typescript-paginate

[![npm version](https://img.shields.io/npm/v/sequelize-typescript-paginate.svg)](https://www.npmjs.com/package/sequelize-typescript-paginate)
[![Coverage Status](https://coveralls.io/repos/marianozunino/sequelize-typescript-paginate/badge.png)](https://coveralls.io/r/marianozunino/sequelize-typescript-paginate)

> Sequelize Base Model with pagination for Sequelize-Typescript
>
> Inspired on https://github.com/eclass/sequelize-paginate

## Installation

```bash
npm i sequelize-typescript-paginate
```

## Usege

```ts
import { PaginatedModel } from 'sequelize-typescript-pagination';
import { Sequelize, Column, DataType, ForeignKey, Table, HasMany } from 'sequelize-typescript';

@Table({ tableName: 'book' })
export class Book extends PaginatedModel {
  @Column({ type: DataType.STRING })
  name: string;
  @ForeignKey(() => Author)
  @Column({ type: DataType.INTEGER })
  authorId: string;
}

@Table({ tableName: 'author' })
export class Author extends PaginatedModel {
  @Column({ type: DataType.STRING })
  name: string;
  @HasMany(() => Book)
  books: Book[];
}

//...
//...
//...

// Default page = 1 and pageSize = 25
const { docs, pages, total } = await Author.paginate();
// Or with extra options
const options = {
  attributes: ['id', 'name'],
  page: 1, // Default 1
  pageSize: 25, // Default 25
  order: [['name', 'DESC']],
  where: { name: { [Op.like]: `%elliot%` } },
};
const { docs, pages, total } = await Author.paginate(options);
```

**NOTE:** _If **options** includes **limit** or **offset** they will be ignored._

## License

[MIT](https://tldrlegal.com/license/mit-license)

---
_Source: https://npm.io/package/sequelize-typescript-paginate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
