Skip to content

A Kurier addon that creates intermediate resource types for many-to-many relationships.

License

Notifications You must be signed in to change notification settings

kurierjs/kurier-addon-many-to-many

Repository files navigation

@kurier/addon-many-to-many

A Kurier addon that creates intermediate resource types for many-to-many relationships.

Usage

Install it using npm or yarn:

$ npm i -D @kurier/addon-many-to-many
$ yarn add -D @kurier/addon-many-to-many

Add it to your Kurier app:

import ManyToManyAddon from "@kurier/addon-many-to-many";
// ...
app.use(ManyToManyAddon);

Apply the addon to any resource relationship by setting the manyToMany flag to true:

import { Resource } from "kurier";
import Designer from "./designer";

export default class Collection extends Resource {
  static schema = {
    attributes: {
      name: String,
      slug: String,
    },
    relationships: {
      designers: {
        type: () => Designer,
        manyToMany: true,
        foreignKeyName: "design_id",
      },
    },
  };
}

License

MIT

About

A Kurier addon that creates intermediate resource types for many-to-many relationships.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published