Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Integrates bookshelf ORM with bi-service

License

Notifications You must be signed in to change notification settings

BohemiaInteractive/bi-service-bookshelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bookshelf with registry & virtuals & visibility & pagination & paranoia & eloquent plugins.

const Service = require('bi-service');
const config = require('bi-config');
const bookshelfBuilder = require('bi-service-bookshelf');

const bookshelf = bookshelfBuilder({/*options*/});

const service = new Service(config);

//enables integrity inspection features
service.resourceManager.register('postgres', bookshelf);


//instantiates model definitions and registers them with  the `registry` plugin interface
//returns object with loaded models
bookshelf.loadModels([
    'path/to/directory/with/model/definitions'
]);

Model definition example eg.: lib/models/orm/user.js

module.exports = function(bookshelf) {

    return bookshelf.Model.extend({
        tableName: 'user'
    });
};

About

Integrates bookshelf ORM with bi-service

Resources

License

Stars

Watchers

Forks

Packages

No packages published