# @hamta/adonis-orm

> Addon for Customize AdonisJS Lucid ORM

Latest version **1.0.14** (published 2023-08-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hamta/adonis-orm
pnpm add @hamta/adonis-orm
yarn add @hamta/adonis-orm
bun add @hamta/adonis-orm
```

## 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.0.14 |
| Published | 2023-08-16 |
| First published | 2023-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ehsan Zarei |
| Maintainers | ezarei88 |
| Keywords | adonisjs, lucid, adonis-lucid, adonis-signature, adonis-lucid-signature |

## Links

- npm: https://www.npmjs.com/package/@hamta/adonis-orm
- Repository: https://github.com/ehsan-zarei/adonis-lucid-signature
- Homepage: https://github.com/ehsan-zarei/adonis-lucid-signature#readme
- Issues: https://github.com/eokwukwe/adonis-hashids/issues
- npm.io page: https://npm.io/package/@hamta/adonis-orm

## Dependencies (5)

- [redis](https://npm.io/package/redis.md) ^4.6.7
- [bcrypt](https://npm.io/package/bcrypt.md) ^5.1.0
- [phc-bcrypt](https://npm.io/package/phc-bcrypt.md) ^1.0.8
- [@adonisjs/lucid](https://npm.io/package/@adonisjs/lucid.md) ^18.4.0
- [@adonisjs/assembler](https://npm.io/package/@adonisjs/assembler.md) ^5.9.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.14 (latest) — 2023-08-16
- 1.0.13 — 2023-08-16
- 1.0.12 — 2023-08-16
- 1.0.11 — 2023-08-16
- 1.0.10 — 2023-08-16
- 1.0.9 — 2023-08-15
- 1.0.8 — 2023-08-15
- 1.0.7 — 2023-08-15
- 1.0.6 — 2023-08-15
- 1.0.5 — 2023-08-15
- 1.0.4 — 2023-08-15
- 1.0.3 — 2023-08-08
- 1.0.2 — 2023-08-02
- 1.0.1 — 2023-08-02
- 1.0.0 — 2023-07-31

## README

# adonis-hashids

> Hashids for AdonisJS 5

[![gh-workflow-image]][gh-workflow-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url] [![download-image]][download-url]


> **This package generates YouTube-like IDs for AdonisJS Lucid models using the `hashids.js` package.  [hashids.js](https://github.com/niieani/hashids.js) is small JavaScript library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.** 

## **Prerequisites**
- [Adonis Lucid](https://docs.adonisjs.com/guides/database/introduction) to be installed and configured

- The db table must have a column named `hashid` of type `string` and it must be `nullable`.


## **Installation**

```
npm i @fcoded/adonis-hashids or  yarn add @fcoded/adonis-hashids
```

## Configuration

```
node ace configure @fcoded/adonis-hashids
```

The configuration file is in `config/hashids.ts`. The default `salt` will be the project name, the default `minLength` is 12 and it uses the default `alphabet` from the [hashids.js](https://github.com/niieani/hashids.js) package.

## **Using the Hashids Mixin**

Apply the mixin on the model you.

```typescript
import { compose } from '@ioc:Adonis/Core/Helpers'
import { column, BaseModel } from '@ioc:Adonis/Lucid/Orm'
import { LucidHashIds } from '@ioc:Adonis/Adons/LucidHashIds'

export default class User extends compose(BaseModel, LucidHashIds){

}
```

The mixin will update the `hashid` column after the recorded is created using the `afterCreate` **Model** hook

Also, if you are using `Route model binding` package, the `routeLookupKey` will be set to the `hashid` by default.

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/eokwukwe/adonis-hashids/test.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/eokwukwe/adonis-hashids/actions/workflows/test.yml "Github action"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"

[npm-image]: https://img.shields.io/npm/v/@fcoded/adonis-hashids/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@fcoded/adonis-hashids/v/latest "npm"

[license-image]: https://img.shields.io/npm/l/@fcoded/adonis-hashids?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[download-image]: https://img.shields.io/npm/dm/%40fcoded/adonis-hashids?style=for-the-badge&logo=npm&label=Downloads
[download-url]: "download"

---
_Source: https://npm.io/package/@hamta/adonis-orm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
