Skip to content

Commit fa4ce7f

Browse files
update description
1 parent 19137da commit fa4ce7f

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

index.js

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,84 @@
22
* @module admin-bro-sequelizejs
33
*
44
* @description
5-
* A Sequelize database adapter for AdminBro.
5+
* ### A Sequelize database adapter for AdminBro.
6+
*
7+
* #### Installation
8+
*
9+
* To install the adapter run
10+
*
11+
* ```
12+
* yarn add admin-bro-sequelizejs
13+
* ```
14+
*
15+
* ### Usage
16+
*
17+
* In order to use it in your project register the adapter first:
18+
*
19+
* ```javascript
20+
* const AdminBro = require('admin-bro')
21+
* const AdminBroSequelize = require('admin-bro-sequelizejs')
22+
*
23+
* AdminBro.registerAdapter(AdminBroSequelize)
24+
* ```
25+
*
26+
* ### Passing an entire database
27+
*
28+
* Sequelize generates folder in your app called `./models` and there is an `index.js` file.
29+
* You can require it and pass to {@link AdminBroOptions} like this:
30+
*
31+
* ```javascript
32+
* const db = require('../models');
33+
* const AdminBro = new AdminBro({
34+
* databases: [db],
35+
* //... other AdminBroOptions
36+
* })
37+
* //...
38+
* ```
39+
*
40+
* ### Passing each resource
41+
*
42+
* Also you can pass a single resource and adjust it to your needs via {@link ResourceOptions}.
43+
*
44+
* So let say you have a model called `vendor` and there is a `vendor.js` file in your `./models`.
45+
* Within this file there is
46+
*
47+
* ```javascript
48+
* //...
49+
* sequelize.define('vendor', //...
50+
* //...
51+
* ```
52+
*
53+
* In order to pass it directly, run this code:
54+
*
55+
* ```javascript
56+
* const db = require('../models');
57+
* const AdminBro = new AdminBro({
58+
* databases: [db], // you can still load an entire database and adjust just one resource
59+
* resources: [{
60+
* resource: db.vendor,
61+
* options: {
62+
* //...
63+
* }
64+
* }]
65+
* })
66+
* //...
67+
* ```
68+
*
69+
*
670
*/
771

872
/**
73+
* Implementation of {@link BaseDatabase} for Sequelize Adapter
74+
*
975
* @type {typeof BaseDatabase}
1076
* @static
1177
*/
1278
const Database = require('./src/database')
1379

1480
/**
81+
* Implementation of {@link BaseResource} for Sequelize Adapter
82+
*
1583
* @type {typeof BaseResource}
1684
* @static
1785
*/

0 commit comments

Comments
 (0)