Module

@adminjs/sequelize

### A Sequelize database adapter for AdminJS.

Installation

To install the adapter run

yarn add @adminjs/sequelize

Usage

In order to use it in your project register the adapter first:

const AdminJS = require('adminjs')
const AdminJSSequelize = require('@adminjs/sequelize')

AdminJS.registerAdapter(AdminJSSequelize)

Passing an entire database

Sequelize generates folder in your app called ./models and there is an index.js file. You can require it and pass to AdminJSOptions like this:

const db = require('../models');
const AdminJS = new AdminJS({
  databases: [db],
  //... other AdminJSOptions
})
//...

Passing each resource

Also you can pass a single resource and adjust it to your needs via ResourceOptions.

So let say you have a model called vendor and there is a vendor.js file in your ./models. Within this file there is

//...
sequelize.define('vendor', //...
//...

In order to pass it directly, run this code:

const db = require('../models');
const AdminJS = new AdminJS({
  databases: [db], // you can still load an entire database and adjust just one resource
  resources: [{
    resource: db.vendor,
    options: {
      //...
    }
  }]
})
//...

View Source adminjs-sequelizejs/index.ts, line 2

View Source adminjs-sequelizejs/lib/index.js, line 2

Members

Class.<BaseDatabase>

# static constant database_1

Implementation of BaseDatabase for Sequelize Adapter

View Source adminjs-sequelizejs/lib/index.js, line 86

Class.<BaseResource>

# static constant resource_1

Implementation of BaseResource for Sequelize Adapter

View Source adminjs-sequelizejs/lib/index.js, line 94

### A Sequelize database adapter for AdminJS.

Installation

To install the adapter run

yarn add @adminjs/sequelize

Usage

In order to use it in your project register the adapter first:

const AdminJS = require('adminjs')
const AdminJSSequelize = require('@adminjs/sequelize')

AdminJS.registerAdapter(AdminJSSequelize)

Passing an entire database

Sequelize generates folder in your app called ./models and there is an index.js file. You can require it and pass to AdminJSOptions like this:

const db = require('../models');
const AdminJS = new AdminJS({
  databases: [db],
  //... other AdminJSOptions
})
//...

Passing each resource

Also you can pass a single resource and adjust it to your needs via ResourceOptions.

So let say you have a model called vendor and there is a vendor.js file in your ./models. Within this file there is

//...
sequelize.define('vendor', //...
//...

In order to pass it directly, run this code:

const db = require('../models');
const AdminJS = new AdminJS({
  databases: [db], // you can still load an entire database and adjust just one resource
  resources: [{
    resource: db.vendor,
    options: {
      //...
    }
  }]
})
//...

View Source adminjs-sequelizejs/index.ts, line 2

View Source adminjs-sequelizejs/lib/index.js, line 2

Members

Class.<BaseDatabase>

# static constant database_1

Implementation of BaseDatabase for Sequelize Adapter

View Source adminjs-sequelizejs/lib/index.js, line 86

Class.<BaseResource>

# static constant resource_1

Implementation of BaseResource for Sequelize Adapter

View Source adminjs-sequelizejs/lib/index.js, line 94