# @druidjs/mixins

> The soft delete mixin takes the following options:

Latest version **0.3.1** (published 2018-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @druidjs/mixins
pnpm add @druidjs/mixins
yarn add @druidjs/mixins
bun add @druidjs/mixins
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2018-08-22 |
| First published | 2018-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | alidcastano |

## Links

- npm: https://www.npmjs.com/package/@druidjs/mixins
- npm.io page: https://npm.io/package/@druidjs/mixins

## Dependencies (1)

- [@types/jest](https://npm.io/package/@types/jest.md) ^23.3.1

## Recent versions

- 0.3.1 (latest) — 2018-08-22
- 0.3.0 — 2018-08-20
- 0.2.5 — 2018-08-20
- 0.2.2 — 2018-08-20
- 0.2.1 — 2018-08-20
- 0.2.0 — 2018-08-20

## README

# druidjs/mixins


## Soft Deletes

The soft delete mixin takes the following options:

- `columnName`: string, the name of the column to mark with the soft delete.
- `softDelete`: string, the name of the query key that will be used as a soft delete.
- `undelete`: string, the name of the query key that will be used to undo a soft delete.
- `hardDelete`: string, the name of the query key that will be used to permanently delete a row. By default, `delete` key is used.
 
Example inittialization: 

```js
import softDeleteQueries from '@druidjs/mixins/softDelete'


const archiveQueries = softDeleteQueries({
  columnName: 'archived',
  softDelete: 'archive',
  undelete: 'unarchive'
})

export default class Note extends archiveQueries(Model) {	
}
```


## Search Index

Initialized mixin with algolia search index.

The following queries exist:
- `index`, to add object(s) to search index.
- `reindex`, to update object(s) in search index.
- `unindex`, to remove object(s) from search index.

Example initialization: 

```js
import * as algoliasearch from 'algoliasearch'
import searchIndexQueries from '@druidjs/mixins/searchAlgolia'

const algolia = algoliasearch(process.env.SEARCH_ID, process.env.SEARCH_KEY)
const searchIndex = algolia.initIndex('test')


export default class Note extends searchIndexQueries(searchIndex)(Model) {	
}
```

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