# loopback-ds-cascade-update-mixin

> Loopback cascade update mixin.

Latest version **1.2.1** (published 2017-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install loopback-ds-cascade-update-mixin
pnpm add loopback-ds-cascade-update-mixin
yarn add loopback-ds-cascade-update-mixin
bun add loopback-ds-cascade-update-mixin
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2017-07-21 |
| First published | 2017-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Tom Kirkpatrick @mrfelton |
| Maintainers | mrfelton |
| Keywords | loopback, strongloop, cascade |

## Links

- npm: https://www.npmjs.com/package/loopback-ds-cascade-update-mixin
- Repository: https://github.com/fullcube/loopback-ds-cascade-update-mixin
- Issues: https://github.com/fullcube/loopback-ds-cascade-update-mixin/issues
- npm.io page: https://npm.io/package/loopback-ds-cascade-update-mixin

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) 2.6.8
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0

## Recent versions

- 1.2.1 (latest) — 2017-07-21
- 1.2.0 — 2017-07-14
- 1.1.2 — 2017-07-12
- 1.1.1 — 2017-06-23
- 1.1.0 — 2017-06-23
- 1.0.1 — 2017-02-08
- 1.0.0 — 2017-02-08

## README

CASCADE UPDATE MIXIN
================

[![Greenkeeper badge](https://badges.greenkeeper.io/fullcube/loopback-ds-cascade-update-mixin.svg)](https://greenkeeper.io/)

[![CircleCI](https://circleci.com/gh/fullcube/loopback-ds-cascade-update-mixin.svg?style=svg)](https://circleci.com/gh/fullcube/loopback-ds-cascade-update-mixin) [![Dependencies](http://img.shields.io/david/fullcube/loopback-ds-cascade-update-mixin.svg?style=flat)](https://david-dm.org/fullcube/loopback-ds-cascade-update-mixin)
[![Coverage Status](https://coveralls.io/repos/github/fullcube/loopback-ds-cascade-update-mixin/badge.svg?branch=master)](https://coveralls.io/github/fullcube/loopback-ds-cascade-update-mixin?branch=master)



This module is designed for the [Strongloop Loopback](https://github.com/strongloop/loopback) framework. It provides cascade update functionality with a simple configuration on your models. This can be used to keep property values synchronised across related models.

INSTALL
================

```bash
  npm install --save loopback-ds-cascade-update-mixin
```

SERVER CONFIG
=============
Add the mixins property to your server/model-config.json:

```json
{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-ds-cascade-update-mixin/lib",
      "../common/mixins"
    ]
  }
}
```

CONFIG
=============

To use with your Models add the `mixins` attribute to the definition object of your model config.

The config keys are the property names that you want to cascade.

The config values are an array of relationships that the property updates should cascade to.


```json
  {
    "name": "Product",
    "properties": {
      "name": {
        "type": "string",
      }
    },
    "relations": {
        "relation1": {
          "type": "hasMany",
          "model": "Property",
          "foreignKey": ""
        }
     },
    "mixins": {
      "CascadeUpdate": {
         "status": [ "relation1", "relation2" ],
         "isTest": [ "relation1", "relation2" "relation3" ]
       }
    }
  }
```

TESTING
=============

Run the tests in `test.js`

```bash
  npm test
```

DEBUGGING
=============

Run with debugging output on:

```bash
  DEBUG='loopback:mixins:cascade-update' npm test
```

---
_Source: https://npm.io/package/loopback-ds-cascade-update-mixin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
